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