diff options
| author | Michel Etienne | 2012-04-06 10:10:44 +0200 |
|---|---|---|
| committer | Michel Etienne | 2012-04-06 10:10:44 +0200 |
| commit | bd4fa6fbbf8d533edccddc5261eecf3f0ca9ce9d (patch) | |
| tree | e5a0ee1ca894d97ef129387869fdbfae95e1d496 /app | |
| parent | 8997a187061244ad086a3985b94a6369d68c837e (diff) | |
| download | chouette-core-bd4fa6fbbf8d533edccddc5261eecf3f0ca9ce9d.tar.bz2 | |
add timetables , update textiles
Diffstat (limited to 'app')
| -rw-r--r-- | app/assets/stylesheets/time_tables.css.scss | 113 | ||||
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 23 | ||||
| -rw-r--r-- | app/views/time_tables/_date.erb | 3 | ||||
| -rw-r--r-- | app/views/time_tables/_form.erb | 42 | ||||
| -rw-r--r-- | app/views/time_tables/_form_date.erb | 5 | ||||
| -rw-r--r-- | app/views/time_tables/_form_period.erb | 6 | ||||
| -rw-r--r-- | app/views/time_tables/_period.erb | 3 | ||||
| -rw-r--r-- | app/views/time_tables/_time_table.erb | 9 | ||||
| -rw-r--r-- | app/views/time_tables/edit.html.erb | 3 | ||||
| -rw-r--r-- | app/views/time_tables/index.html.erb | 23 | ||||
| -rw-r--r-- | app/views/time_tables/new.html.erb | 3 | ||||
| -rw-r--r-- | app/views/time_tables/show.html.erb | 68 |
12 files changed, 301 insertions, 0 deletions
diff --git a/app/assets/stylesheets/time_tables.css.scss b/app/assets/stylesheets/time_tables.css.scss new file mode 100644 index 000000000..e6fb6cec3 --- /dev/null +++ b/app/assets/stylesheets/time_tables.css.scss @@ -0,0 +1,113 @@ +// Place all the styles related to the lines controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ +@mixin div_for_object { + margin-bottom: 20px; + + .color { + width: 64px; + height: 64px; + float: left; + margin-right: 10px; + } + + img { + float: left; + margin-right: 10px; + } + + img.preview { + width: 90px; + height: 70px; + } + + a { + display:block; + text-decoration: underline; + margin: 5px 0px 0px 0px; + } + + .info { + font-size: 10px; + color: #777; + font-weight: normal; + line-height: 14px; + margin-top: 5px; + + a { + display:inline; + color: #777; + } + + .actions { + margin-top: 14px; + a { + color: #666; + padding-left: 12px; + } + + a.edit { + background: url(image-path('user_interface/ui/edit-small.png')) no-repeat 0% 50%; + } + a.remove { + background: url(image-path('user_interface/ui/remove-small.png')) no-repeat 0% 50%; + } + } + + p { + margin:0; + } + } +} + +@mixin content_to_clear { + content: " "; + display: block; + height: 0; + clear: both; + visibility: hidden; +} + +@mixin after_div_for_object { + @include content_to_clear; +} + +#workspace.time_tables.index +{ + .time_table:after { + @include after_div_for_object; + } + + .time_tables { + margin-top: 20px; + } + + .time_tables:after { + @include content_to_clear; + } + + .time_table { + @include div_for_object; + + /* to create multi-column index */ + width: 350px; + float: left; + padding-right: 10px; + + } +} + + +#workspace .order { + float: right; + padding: 15px 0; + font-size: 0.8em; + + a { text-decoration: underline; } + + a.current { + font-weight: bold; + text-decoration: none; + } +} + diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb new file mode 100644 index 000000000..dbecde0eb --- /dev/null +++ b/app/controllers/time_tables_controller.rb @@ -0,0 +1,23 @@ +class TimeTablesController < ChouetteController + defaults :resource_class => Chouette::TimeTable + respond_to :html + respond_to :xml + respond_to :json + + belongs_to :referential + + protected + + def collection + @q = referential.time_tables.search(params[:q]) + @time_tables ||= @q.result(:distinct => true).order(:comment).paginate(:page => params[:page], :per_page => 10) + end + + def resource_url(time_table = nil) + referential_time_table_path(referential, time_table || resource) + end + + def collection_url + referential_time_tables_path(referential) + end +end diff --git a/app/views/time_tables/_date.erb b/app/views/time_tables/_date.erb new file mode 100644 index 000000000..4430efd33 --- /dev/null +++ b/app/views/time_tables/_date.erb @@ -0,0 +1,3 @@ +<%= div_for(date) do %> + <%= date.date %> +<% end %> diff --git a/app/views/time_tables/_form.erb b/app/views/time_tables/_form.erb new file mode 100644 index 000000000..1d78ad84e --- /dev/null +++ b/app/views/time_tables/_form.erb @@ -0,0 +1,42 @@ +<%= semantic_form_for [@referential, @time_table] do |form| %> + <%= form.inputs do %> + <%= form.input :comment %> + <%= form.input :version %> + <%= form.input :monday, :as => :boolean %> + <%= form.input :tuesday, :as => :boolean %> + <%= form.input :wednesday, :as => :boolean %> + <%= form.input :thursday, :as => :boolean %> + <%= form.input :friday, :as => :boolean %> + <%= form.input :saturday, :as => :boolean %> + <%= form.input :sunday, :as => :boolean %> + + <% if @time_table.new_record? %> + <%= form.input :objectid %> + <% else %> + <li> + <label><%= @time_table.human_attribute_name("objectid") %>: </label> + <%= @time_table.objectid %> + </li> + <% end %> + <% end %> + <!-- + <% if not @time_table.new_record? %> + <label><%= @time_table.human_attribute_name("periods") %>: </label> + <%= form.inputs :for => :periods do |period_form| %> + <%= period_form.input :period_start, :as => :date ,:label => @time_table.human_attribute_name("period_start")%> + <%= period_form.input :period_end, :as => :date ,:label => @time_table.human_attribute_name("period_end")%> + <% end %> + <label><%= @time_table.human_attribute_name("dates") %>: </label> + <%= form.inputs :for => :dates do |date_form| %> + <%= date_form.input :date, :as => :date %> + <% end %> + + <% end%> + --> + + <%= form.buttons do %> + <%= form.commit_button %> + <li><%= t('or') %></li> + <li><%= link_to t('cancel'), :back %></li> + <% end %> +<% end %> diff --git a/app/views/time_tables/_form_date.erb b/app/views/time_tables/_form_date.erb new file mode 100644 index 000000000..2b841c377 --- /dev/null +++ b/app/views/time_tables/_form_date.erb @@ -0,0 +1,5 @@ +<%= semantic_form_for [@referential, @time_table_date] do |form| %> + <%= form.inputs do %> + <%= form.input :date , :as => :date%> + <% end %> +<% end %> diff --git a/app/views/time_tables/_form_period.erb b/app/views/time_tables/_form_period.erb new file mode 100644 index 000000000..110bad1eb --- /dev/null +++ b/app/views/time_tables/_form_period.erb @@ -0,0 +1,6 @@ +<%= semantic_form_for [@referential, @time_table_period] do |form| %> + <%= form.inputs do %> + <%= form.input :period_start, :as => :date %> + <%= form.input :period_end, :as => :date %> + <% end %> +<% end %> diff --git a/app/views/time_tables/_period.erb b/app/views/time_tables/_period.erb new file mode 100644 index 000000000..a8be8c73a --- /dev/null +++ b/app/views/time_tables/_period.erb @@ -0,0 +1,3 @@ +<%= div_for(period) do %> + <%= period.period_start %> - <%= period.period_end %> +<% end %> diff --git a/app/views/time_tables/_time_table.erb b/app/views/time_tables/_time_table.erb new file mode 100644 index 000000000..ea2d69be4 --- /dev/null +++ b/app/views/time_tables/_time_table.erb @@ -0,0 +1,9 @@ +<%= div_for(time_table) do %> + <%= link_to time_table.comment, [@referential, time_table] %> + <div class="info"> + <div class="actions"> + <%= link_to t("actions.edit"), edit_referential_time_table_path(@referential, time_table), :class => "edit" %> | + <%= link_to t("actions.destroy"), referential_time_table_path(@referential, time_table), :method => :delete, :confirm => t('time_tables.actions.destroy_confirm'), :class => "remove" %> + </div> + </div> +<% end %> diff --git a/app/views/time_tables/edit.html.erb b/app/views/time_tables/edit.html.erb new file mode 100644 index 000000000..d80974841 --- /dev/null +++ b/app/views/time_tables/edit.html.erb @@ -0,0 +1,3 @@ +<%= title_tag t('time_tables.edit.title', :time_table => @time_table.comment) %> + +<%= render "form" %> diff --git a/app/views/time_tables/index.html.erb b/app/views/time_tables/index.html.erb new file mode 100644 index 000000000..90225446a --- /dev/null +++ b/app/views/time_tables/index.html.erb @@ -0,0 +1,23 @@ +<%= title_tag t('time_tables.index.title') %> + +<%= search_form_for @q, :url => referential_time_tables_path(@referential), :html => {:method => :get} do |f| %> + <%= f.label :comment_cont, "#{t('.comment')} :" %> + <%= f.text_field :comment_cont %> + + <%= f.submit t('actions.search') %> <%= t("or") %> + <%= link_to t("cancel"), referential_time_tables_path(@referential) %> +<% end %> + +<%= will_paginate @time_tables %> +<div class="time_tables paginated_content"> + <%= render :partial => "time_table", :collection => @time_tables %> +</div> +<%= will_paginate @time_tables %> + + +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('time_tables.actions.new'), new_referential_time_table_path(@referential), :class => "add" %></li> + <br> +</ul> +<% end %> diff --git a/app/views/time_tables/new.html.erb b/app/views/time_tables/new.html.erb new file mode 100644 index 000000000..90b9876e2 --- /dev/null +++ b/app/views/time_tables/new.html.erb @@ -0,0 +1,3 @@ +<%= title_tag t('time_tables.new.title') %> + +<%= render "form" %> diff --git a/app/views/time_tables/show.html.erb b/app/views/time_tables/show.html.erb new file mode 100644 index 000000000..a03c9e570 --- /dev/null +++ b/app/views/time_tables/show.html.erb @@ -0,0 +1,68 @@ +<%= title_tag t('time_tables.show.title', :time_table => @time_table.comment )%> + +<div class="time_table_show"> + + <div class="summary"> + <p> + <label><%= @time_table.human_attribute_name("comment") %>: </label> + <%= @time_table.comment %> + </p> + <p> + <label><%= @time_table.human_attribute_name("version") %>: </label> + <%= @time_table.version %> + </p> + <p> + <label><%= @time_table.human_attribute_name("objectid") %>: </label> + <%= @time_table.objectid %> + </p> + <p> + <label><%= @time_table.human_attribute_name("monday") %>: </label> + <%= @time_table.monday %> + </p> + <p> + <label><%= @time_table.human_attribute_name("tuesday") %>: </label> + <%= @time_table.tuesday %> + </p> + <p> + <label><%= @time_table.human_attribute_name("wednesday") %>: </label> + <%= @time_table.wednesday %> + </p> + <p> + <label><%= @time_table.human_attribute_name("thursday") %>: </label> + <%= @time_table.thursday %> + </p> + <p> + <label><%= @time_table.human_attribute_name("friday") %>: </label> + <%= @time_table.friday %> + </p> + <p> + <label><%= @time_table.human_attribute_name("saturday") %>: </label> + <%= @time_table.saturday %> + </p> + <p> + <label><%= @time_table.human_attribute_name("sunday") %>: </label> + <%= @time_table.sunday %> + </p> + </div> + <div> + <p> + <label><%= @time_table.human_attribute_name("periods") %>: </label> + </p> + <%= render :partial => "period", :collection => @time_table.periods %> + </div> + <div> + <p> + <label><%= @time_table.human_attribute_name("dates") %>: </label> + </p> + <%= render :partial => "date", :collection => @time_table.dates %> + </div> + +</div> + +<% content_for :sidebar do %> +<ul class="actions"> + <li><%= link_to t('time_tables.actions.edit'), edit_referential_time_table_path(@referential, @time_table), :class => "edit" %></li> + <li><%= link_to t('time_tables.actions.destroy'), referential_time_table_path(@referential, @time_table), :method => :delete, :confirm => t('time_tables.actions.destroy_confirm'), :class => "remove" %></li> + <br> +</ul> +<% end %> |
