diff options
| author | Luc Donnet | 2012-10-09 14:11:26 +0200 |
|---|---|---|
| committer | Luc Donnet | 2012-10-09 14:11:26 +0200 |
| commit | b541f116a35f213990e54e3184c37911c1d89ebf (patch) | |
| tree | 0045987da710c4e4d46bdc30697a39ffc9b7505e | |
| parent | e8c97dbaa2589291018fc5d2ec8326b2be40e9f9 (diff) | |
| download | chouette-core-b541f116a35f213990e54e3184c37911c1d89ebf.tar.bz2 | |
Add year calendar for time table show
| -rw-r--r-- | Gemfile | 2 | ||||
| -rw-r--r-- | Gemfile.lock | 18 | ||||
| -rw-r--r-- | app/assets/stylesheets/calendar.css.scss | 98 | ||||
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 5 | ||||
| -rw-r--r-- | app/views/time_tables/show.html.erb | 33 | ||||
| -rw-r--r-- | config/locales/layouts.yml | 4 | ||||
| -rw-r--r-- | db/schema.rb | 30 |
7 files changed, 174 insertions, 16 deletions
@@ -13,7 +13,6 @@ platforms :jruby do gem 'jruby-openssl' gem "jruby-rack-worker" gem 'warbler' - gem "jruby-rack-worker" end platforms :ruby do @@ -37,6 +36,7 @@ gem 'RedCloth' gem 'jquery-rails' gem "modernizr-rails", "~> 2.0.6" gem 'gravatar_image_tag' +gem 'calendar_helper', :git => "git://github.com/topfunky/calendar_helper.git" gem "acts_as_tree", :git => "git://github.com/dryade/acts_as_tree.git" #gem 'ninoxe', :git => 'git://github.com/dryade/ninoxe.git' diff --git a/Gemfile.lock b/Gemfile.lock index b526715f7..85cb92b1e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://chouette.dryade.priv/ninoxe - revision: f6d327cfa9380bca083eacd5b6c060117a74f31b + revision: 51dddb6a98e02b88d5f4f02e1b3142bd8583b6e0 specs: ninoxe (0.0.8) GeoRuby @@ -60,6 +60,13 @@ GIT rgeo (~> 0.3.8) GIT + remote: git://github.com/topfunky/calendar_helper.git + revision: 763a497dbd8833b98d92815667b367ade938c00c + specs: + calendar_helper (0.2.5) + open4 + +GIT remote: git://sim.dryade.priv/user_interface revision: d828d7107f2b4025853cbfa7cc0e76cceca27da6 specs: @@ -195,6 +202,7 @@ GEM jruby-rack (1.1.9) jruby-rack-worker (0.4-java) jruby-rack (>= 1.1.1) + json (1.7.5) json (1.7.5-java) json_pure (1.7.5) launchy (2.1.0) @@ -203,6 +211,7 @@ GEM addressable (~> 2.2.6) ffi (~> 1.0.9) spoon (~> 0.0.1) + libv8 (3.3.10.4) libwebsocket (0.1.5) addressable listen (0.4.7) @@ -226,7 +235,9 @@ GEM net-ssh (>= 1.99.1) nokogiri (1.5.5) nokogiri (1.5.5-java) + open4 (1.3.0) orm_adapter (0.4.0) + pg (0.11.0) polyamorous (0.5.0) activerecord (~> 3.0) polyglot (0.3.3) @@ -307,10 +318,13 @@ GEM hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) + sqlite3 (1.3.6) squeel (1.0.9) activerecord (~> 3.0) activesupport (~> 3.0) polyamorous (~> 0.5.0) + therubyracer (0.10.2) + libv8 (~> 3.3.10) therubyrhino (2.0.1) therubyrhino_jar (>= 1.7.3) therubyrhino_jar (1.7.4) @@ -336,6 +350,7 @@ GEM PLATFORMS java + ruby DEPENDENCIES RedCloth @@ -345,6 +360,7 @@ DEPENDENCIES acts_as_list (= 0.1.6) acts_as_tree! apartment! + calendar_helper! capistrano capistrano-ext capybara diff --git a/app/assets/stylesheets/calendar.css.scss b/app/assets/stylesheets/calendar.css.scss new file mode 100644 index 000000000..fe8dedde7 --- /dev/null +++ b/app/assets/stylesheets/calendar.css.scss @@ -0,0 +1,98 @@ +/* + A grey based theme, inspired by Blinksale and their ColorBurn widget. http://firewheeldesign.com + + AUTHOR: Geoffrey Grosenbach http://nubyonrails.com + + Colors: + dk: 787888 + lt: 4f4f5b + lter: a8a8a8 + white: ffffff +*/ + +/* TODO */ + +.year_choice{ + font-size: 16px; + font-weight: bold; + margin: 20px 0 0 0; + text-align: center; + + .year{ + text-align: center; + + } + +} + +.calendar_helper{ + + padding: auto; + + .test { margin: auto;} +} + +.calendar { + color: white; + text-align: center; + margin-left: 30px; + display: inline-table; +} + +thead tr { + color: black; +} + + th.monthName { + font-weight: bold; + text-align: center; + padding-top: 1em; + padding-bottom: 0.7em; + color: black; +} + +.dayName th { + font-size: 0.7em; + text-align: center; + padding-top: 0.6em; + padding-bottom: 0.3em; + background-color: #303030; + color: white; + border-bottom: 1px solid white; +} + +.otherMonth, .day, .specialDay { + padding: 0.7em; + border-right: 1px solid #111111; + border-bottom: 1px solid #111111; +} + +.otherMonth { + color: #999999; + background-color: #4f4f5b; +} + +.day, .specialDay { + border-bottom: 1px solid #111111; + background-color: #333333; +} +.specialDay { + background-color: #a8a8a8 !important; + color: black; +} + +.specialDay a, .specialDay a:visited, .specialDay a:hover { + color: white; + text-decoration: none; + padding: 0.7em; +} +.specialDay a:hover { + color: black; +} +.weekendDay { + background-color: #787888; +} +.today { + background-color: white; + color: black; +}
\ No newline at end of file diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index 8f57f18c0..a9f799e9d 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -6,6 +6,11 @@ class TimeTablesController < ChouetteController belongs_to :referential + def show + @year = params[:year] ? params[:year].to_i : Date.today.cwyear + show! + end + def comment_filter respond_to do |format| format.json { render :json => filtered_time_tables_maps} diff --git a/app/views/time_tables/show.html.erb b/app/views/time_tables/show.html.erb index 3536dedae..2b7841baf 100644 --- a/app/views/time_tables/show.html.erb +++ b/app/views/time_tables/show.html.erb @@ -1,3 +1,4 @@ +<% require 'calendar_helper' %> <%= title_tag t('time_tables.show.title', :time_table => @time_table.comment )%> <div class="time_table_show"> @@ -61,14 +62,28 @@ <label><%= @time_table.human_attribute_name("objectid") %>: </label> <%= @time_table.objectid %> </p> - <p> - <label><%= @time_table.human_attribute_name("creation_time") %>: </label> - <%= l @time_table.creation_time %> - </p> - <p> - <label><%= @time_table.human_attribute_name("creator_id") %>: </label> - <%= @time_table.creator_id %> - </p> + + <div class="year_choice"> + <span class="previous"> <%= link_to("<", :year => (@year - 1) ) %> </span> + <span class="year"> <%= "#{@year}" %> </span> + <span class="next"> <%= link_to(">", :year => (@year + 1) ) %> </span> + </div> + <div class="calendar_helper"> + <div class="test"> + <%= cal = "" + (1..12).each do |month| + cal << calendar(:year => @year, :month => month, :first_day_of_week => 1) do |d| + if @time_table.include_day?(d) + [link_to(d.mday, edit_referential_time_table_path(@referential, @time_table) ), {:class => "specialDay"}] + end + end + end + cal.html_safe + %> + </div> + </div> + + </div> <h3 class="time_table_dates"> <a class="dates"><%= @time_table.human_attribute_name("dates") %> @@ -99,4 +114,6 @@ <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> + + <%= creation_tag(@time_table) %> <% end %> diff --git a/config/locales/layouts.yml b/config/locales/layouts.yml index 60cac8cda..852e48450 100644 --- a/config/locales/layouts.yml +++ b/config/locales/layouts.yml @@ -8,6 +8,8 @@ en: sign_out: "Sign out" tabs: dashboard: "dashboard" + creation_tag: + title: Create fr: layouts: back_to_dashboard: "Retour au Tableau de Bord" @@ -18,3 +20,5 @@ fr: sign_out: "Déconnexion" tabs: dashboard: "Tableau de bord" + creation_tag: + title: Création diff --git a/db/schema.rb b/db/schema.rb index bf0284d15..20c522d1d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -182,22 +182,32 @@ ActiveRecord::Schema.define(:version => 20120926144619) do t.string "arguments", :limit => 1000 t.integer "position" t.string "severity" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end add_index "file_validation_log_messages", ["file_validation_id"], :name => "index_file_validation_log_messages_on_file_validation_id" create_table "file_validations", :force => true do |t| t.string "status" - t.string "options" + t.string "options", :limit => 2000 t.string "file_name" t.string "file_type" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "organisation_id" end + create_table "geometry_columns", :id => false, :force => true do |t| + t.string "f_table_catalog", :limit => 256, :null => false + t.string "f_table_schema", :limit => 256, :null => false + t.string "f_table_name", :limit => 256, :null => false + t.string "f_geometry_column", :limit => 256, :null => false + t.integer "coord_dimension", :null => false + t.integer "srid", :null => false + t.string "type", :limit => 30, :null => false + end + create_table "group_of_lines", :force => true do |t| t.string "objectid", :null => false t.integer "object_version" @@ -327,8 +337,8 @@ ActiveRecord::Schema.define(:version => 20120926144619) do t.datetime "updated_at" t.string "prefix" t.string "projection_type" - t.string "bounding_box", :limit => nil t.string "time_zone" + t.string "the_geom" t.string "bounds" t.integer "organisation_id" end @@ -355,6 +365,14 @@ ActiveRecord::Schema.define(:version => 20120926144619) do t.integer "line_id", :limit => 8 end + create_table "spatial_ref_sys", :id => false, :force => true do |t| + t.integer "srid", :null => false + t.string "auth_name", :limit => 256 + t.integer "auth_srid" + t.string "srtext", :limit => 2048 + t.string "proj4text", :limit => 2048 + end + create_table "stop_areas", :force => true do |t| t.integer "parent_id", :limit => 8 t.string "objectid", :null => false |
