bootstrap to forms
This commit is contained in:
parent
ef55c642d0
commit
c526882f27
|
@ -3,6 +3,11 @@ class AlbumsController < ApplicationController
|
|||
skip_before_filter :authenticate_user!, :only => [:index, :show]
|
||||
|
||||
def index
|
||||
add_breadcrumb t('activerecord.models.album.popular'), collections_path, :title => t('activerecord.models.album.popular')
|
||||
add_breadcrumb t('activerecord.actions.create', :model => I18n.t('activerecord.models.album.single')), new_album_path,
|
||||
:title => t('activerecord.actions.create', :model => I18n.t('activerecord.models.album.single')),
|
||||
:li_icon => 'icon-plus-sign'
|
||||
|
||||
if params[:tag_id]
|
||||
@albums = Album.where(:conditions => [ "id IN ( SELECT DISTINCT photos.album_id FROM photos WHERE photos.id IN ( SELECT photo_id FROM photo_tags WHERE photo_tags.tag_id = :q) )", { :q => Tag.find( params[:tag_id] ).id } ]).order('title')
|
||||
elsif params[:q]
|
||||
|
|
|
@ -36,8 +36,10 @@ class CollectionsController < ApplicationController
|
|||
|
||||
def new
|
||||
@collection = Collection.new
|
||||
add_breadcrumb t('activerecord.models.collection.other').mb_chars.capitalize.to_s, collections_path, :title => t('activerecord.models.collection.other')
|
||||
add_breadcrumb t('activerecord.actions.new', :model => I18n.t('activerecord.models.collection.one')), new_collection_path, :title => t('activerecord.actions.new')
|
||||
add_breadcrumb t('activerecord.models.collection.other').mb_chars.capitalize.to_s, collections_path,
|
||||
:title => t('activerecord.models.collection.other')
|
||||
add_breadcrumb t('activerecord.actions.new', :model => I18n.t('activerecord.models.collection.one')), new_collection_path,
|
||||
:title => t('activerecord.actions.new', :model => I18n.t('activerecord.models.collection.one'))
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
|
@ -37,9 +37,9 @@ class PhotosController < ApplicationController
|
|||
def untouched
|
||||
if params[:album_id]
|
||||
@album = Album.find( params[:album_id])
|
||||
@photos = @album.photos.untouched
|
||||
@photos = @album.photos.untouched.page(@page).per(@per_page)
|
||||
else
|
||||
@photos = Photo.untouched()
|
||||
@photos = Photo.untouched().page(@page).per(@per_page)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
|
|
@ -5,26 +5,59 @@
|
|||
|
||||
<div id="map_canvas"></div>
|
||||
|
||||
<%= hidden_field_tag :all_tags, "'#{Tag.find(:all).map { |tag| tag.title }.join('\',\'')}'" %>
|
||||
<%= hidden_field_tag :collection_id, params[:collection_id] %>
|
||||
<%= form.hidden_field :id %>
|
||||
<%= form.hidden_field :latitude %>
|
||||
<%= form.hidden_field :longitude %>
|
||||
<fieldset>
|
||||
<%= hidden_field_tag :all_tags, "'#{Tag.all.map { |tag| tag.title }.join('\',\'')}'" %>
|
||||
<%= hidden_field_tag :collection_id, params[:collection_id] %>
|
||||
<%= form.hidden_field :id %>
|
||||
<%= form.hidden_field :latitude %>
|
||||
<%= form.hidden_field :longitude %>
|
||||
|
||||
<%= form.label :title, :Title, {:class => 'big'} %><br />
|
||||
<%= form.text_field :title, {:class => 'big'} %><br />
|
||||
<div class="control-group">
|
||||
<%= form.label :title, t('activerecord.models.album.attributes.title'), {:class => 'control-label'} %>
|
||||
<div class="controls">
|
||||
<%= form.text_field :title, {:class => 'input-xlarge'} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= form.label :description %><br />
|
||||
<%= form.text_area :description %><br />
|
||||
<div class="control-group">
|
||||
<%= form.label :description, t('activerecord.models.album.attributes.description'), {:class => 'control-label'} %>
|
||||
<div class="controls">
|
||||
<%= form.text_area :description, {:class => 'input-xlarge', :rows => 5} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= form.label :address %><br />
|
||||
<%= form.text_area :address, { :rows => 3} %><br />
|
||||
<div class="control-group">
|
||||
<%= form.label :public, t('activerecord.models.album.attributes.visible'), {:class => 'control-label'} %>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<%= check_box 'collection', :public %> <%= t(:make_visible_for_all) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= form.label :note %><br />
|
||||
<%= form.text_area :note %><br />
|
||||
<div class="control-group">
|
||||
<%= form.label :address, t('activerecord.models.album.attributes.address'), {:class => 'control-label'} %>
|
||||
<div class="controls">
|
||||
<%= form.text_area :address, {:class => 'input-xlarge', :rows => 5} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= form.label :tags %><br />
|
||||
<%= form.text_field :tags, { :autocomplete => "off", :class => 'tag_list', :value => (@album.tags.map{|tag|tag.title}.join(" ") unless @album.tags.nil?) } %><br />
|
||||
<div class="control-group">
|
||||
<%= form.label :note, t('activerecord.models.album.attributes.note'), {:class => 'control-label'} %>
|
||||
<div class="controls">
|
||||
<%= form.text_area :note, {:class => 'input-xlarge', :rows => 5} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
Contains: <%= @album.photos.count %> photos<br/>
|
||||
|
||||
<div class="control-group">
|
||||
<%= form.label :tags, t('activerecord.models.album.attributes.tags'), {:class => 'control-label'} %>
|
||||
<div class="controls">
|
||||
<%= form.text_field :tags, {:class => 'input-xlarge', :autocomplete => "off", :class => 'tag_list', :value => (@album.tags.map{|tag|tag.title}.join(" ") unless @album.tags.nil?) } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<br />
|
||||
Contains: <%= @album.photos.count %> photos<br/>
|
||||
</fieldset>
|
|
@ -1,8 +1,9 @@
|
|||
<h1>New Album</h1>
|
||||
|
||||
<%= form_for @album do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => "form", :object => f %>
|
||||
<%= f.submit "Create" %>
|
||||
<%= form_for @album, :html => {:class => 'form-horizontal'} do |f| %>
|
||||
<legend><%= t('activerecord.actions.new', :model => I18n.t('activerecord.models.album.one')) %></legend>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => "form", :object => f %>
|
||||
<div class="form-actions">
|
||||
<%= f.button "Create", :class => 'btn btn-primary btn-large' %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
@ -13,6 +13,15 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<%= form.label :public, t('activerecord.models.collection.attributes.visible'), {:class => 'control-label'} %>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<%= check_box 'collection', :public %> <%= t(:make_visible_for_all) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% unless @collection.albums.empty? %>
|
||||
<%= form.label :albums %>
|
||||
<% @collection.albums.each do |album| %>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
ru:
|
||||
home_page: "Главная"
|
||||
make_visible_for_all: "Сделать видимым для всех"
|
||||
views:
|
||||
pagination:
|
||||
first: "« первая"
|
||||
|
@ -9,6 +10,11 @@ ru:
|
|||
truncate: "..."
|
||||
|
||||
activerecord:
|
||||
actions:
|
||||
new: "Новый(ая) %{model}"
|
||||
create: "Создать %{model}"
|
||||
update: "Обновить %{model}"
|
||||
destroy: "Удалить %{model}"
|
||||
models:
|
||||
user: Пользователь
|
||||
collection:
|
||||
|
@ -17,15 +23,28 @@ ru:
|
|||
many: "коллекций"
|
||||
other: "коллекции"
|
||||
single: "коллекцию"
|
||||
popular: Полулярные коллекции
|
||||
album: Альбом
|
||||
photo: Фотография
|
||||
photo_tag: Тег
|
||||
actions:
|
||||
new: "Новая %{model}"
|
||||
create: "Создать %{model}"
|
||||
update: "Обновить %{model}"
|
||||
destroy: "Удалить %{model}"
|
||||
popular: "Полулярные коллекции"
|
||||
attributes:
|
||||
title: "Заголовок"
|
||||
description: "Описание"
|
||||
visible: "Видимость"
|
||||
album:
|
||||
one: "альбом"
|
||||
few: "альбомов"
|
||||
many: "альбомов"
|
||||
other: "альбомы"
|
||||
single: "альбом"
|
||||
popular: "Полулярные альбомы"
|
||||
attributes:
|
||||
title: "Заголовок"
|
||||
description: "Описание"
|
||||
visible: "Видимость"
|
||||
address: "Адрес"
|
||||
note: "Примечание"
|
||||
tags: "Теги"
|
||||
|
||||
photo: "Фотография"
|
||||
photo_tag: "Тег"
|
||||
|
||||
albums_counter:
|
||||
one: "Содержит %{count} альбом"
|
||||
|
|
Loading…
Reference in a new issue