diff options
| -rw-r--r-- | app/assets/javascripts/time_tables.js.coffee | 21 | ||||
| -rw-r--r-- | app/assets/stylesheets/main/time_tables.css.scss | 162 | ||||
| -rw-r--r-- | app/controllers/access_points_controller.rb | 1 | ||||
| -rw-r--r-- | app/controllers/chouette_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/stop_areas_controller.rb | 2 | ||||
| -rw-r--r-- | app/views/time_tables/_date_fields.erb | 7 | ||||
| -rw-r--r-- | app/views/time_tables/_excluded_date_fields.erb | 7 | ||||
| -rw-r--r-- | app/views/time_tables/_form.erb | 34 | ||||
| -rw-r--r-- | app/views/time_tables/_period_fields.erb | 10 | ||||
| -rw-r--r-- | config/locales/time_tables.yml | 4 | 
10 files changed, 96 insertions, 154 deletions
diff --git a/app/assets/javascripts/time_tables.js.coffee b/app/assets/javascripts/time_tables.js.coffee index 972747ee4..71b9ca14f 100644 --- a/app/assets/javascripts/time_tables.js.coffee +++ b/app/assets/javascripts/time_tables.js.coffee @@ -7,27 +7,6 @@ jQuery ->    $('.time_tables a.calendars').click(switch_calendars) -  switch_dates = (event) ->  -    event.preventDefault() -    $('.time_tables .dates.content').toggle('slow') -    $('a.dates .switcher').toggle() - -  $('.time_tables a.dates').click(switch_dates) - -  switch_excluded_dates = (event) ->  -    event.preventDefault() -    $('.time_tables .excluded_dates.content').toggle('slow') -    $('a.excluded_dates .switcher').toggle() - -  $('.time_tables a.excluded_dates').click(switch_excluded_dates) - -  switch_periods = (event) ->  -    event.preventDefault() -    $('.time_tables .periods.content').toggle('slow') -    $('a.periods .switcher').toggle() - -  $('.time_tables a.periods').click(switch_periods) -  # add trigger when creating new date or period entries to activate datepicker    tt_datepickerI18n = (index, element) ->      # do nothing if a datepicker is already attached diff --git a/app/assets/stylesheets/main/time_tables.css.scss b/app/assets/stylesheets/main/time_tables.css.scss index 09ab50283..4f8729076 100644 --- a/app/assets/stylesheets/main/time_tables.css.scss +++ b/app/assets/stylesheets/main/time_tables.css.scss @@ -88,112 +88,72 @@  #workspace.time_tables.edit,#workspace.time_tables.new,#workspace.time_tables.create,#workspace.time_tables.update  { -      h3 { -      .dates { -      cursor: pointer; -      } -      .periods { -      cursor: pointer; -      } -      .excluded_dates { -      cursor: pointer; -      } -    } - -   - -  .dates ol { -      margin-top: -0.3em; -      margin-bottom: 1em; -      margin-left: 25%; -      padding: 0; -      width: 75%; -    } -    .dates ol li { padding : 0.3em 0; } - -    .dates ol li label { -      width: 40%; -      margin-top: -0.3em; -    } -  .dates ol li.fl1 {float: left; width: 30% ;} -  .dates ol li.fl1 label {width: 40%; margin-top: -0.3em; } -  .dates ol li.fl1 input { width: 50%; } -   -  .excluded_dates ol { -      margin-top: -0.3em; -      margin-bottom: 1em; -      margin-left: 25%; -      padding: 0; -      width: 75%; +    h3 { +        .dates { +            cursor: pointer; +        } +        .periods { +            cursor: pointer; +        } +        .excluded_dates { +            cursor: pointer; +        }      } -    .excluded_dates ol li { padding : 0.3em 0; } -    .excluded_dates ol li label { -      width: 40%; -      margin-top: -0.3em; +    #dates,#excluded_dates,#periods{ +        .nested-fields { +            margin: 5px; +             +            ol {             +                li { +                    display: inline; +                } +            } +        } +         +        margin-left: 25%;      } -  .excluded_dates ol li.fl1 {float: left; width: 30% ;} -  .excluded_dates ol li.fl1 label {width: 40%; margin-top: -0.3em; } -  .excluded_dates ol li.fl1 input { width: 50%; } -   - -  .periods ol { -      margin-top: -0.3em; -      margin-bottom: 1em; -      margin-left: 25%; -      padding: 0; -      width: 75%; +     +    .day_type ol { +        float: left; +        margin: 0; +        padding: 0 0 0 0; +        width: 100%; +        list_style: none outside none; +        margin-top: 1em; +        margin-bottom: 1em; +    } +    .day_type ol li { +        float: left; +        margin: 0 O 0 0; +        width: auto; +        padding: 0; +    } +    .day_type_label { +        float: left; +        margin-top: 0; +        width: 25%; +    } +    .day_type ol li label { +        padding-left: 10%; +        margin-top: 0; +    } +         +    a.add_fields { +        margin-left: 25%; +        margin-top: 20px; +        padding-left: 18px; +        background: url(image-path('icons/add.png')) no-repeat 0% 50%;      } -    .periods ol li { padding : 0.3em 0; } - -    .periods ol li label { -      width: 40%; -      margin-top: -0.3em; +     +    a.remove_fields { +        margin-left: 10px; +        padding-left: 18px; +        background: url(image-path('icons/remove.png')) no-repeat 0% 50%;      } -  .periods ol li.fl1 {float: left; width: 30% ;} -  .periods ol li.fl1 label {width: 40%; margin-top: -0.3em; } -  .periods ol li.fl1 input { width: 50%; } -   -  .periods ol li.fl2 {float: left; width: 30% ;} -  .periods ol li.fl2 label {width: 40%; margin-top: -0.3em;} -  .periods ol li.fl2 input { width: 50%; } -  .day_type ol { -      float: left; -      margin: 0; -      padding: 0 0 0 0; -      width: 100%; -      list_style: none outside none; -      margin-top: 1em; -      margin-bottom: 1em; -    } -  .day_type ol li { -      float: left; -      margin: 0 O 0 0; -      width: auto; -      padding: 0; -    } -  .day_type_label { -      float: left; -      margin-top: 0; -      width: 25%; -    } -  .day_type ol li label { -      padding-left: 10%; -      margin-top: 0; +    .actions{ +        margin-top: 20px;      } -   -   -  a.add_fields { -    margin-left: 25%; -    color: #666; -    padding-left: 18px; -    background: url(image-path('icons/add.png')) no-repeat 0% 50%; -  } -  a.remove_fields { -    color: #666; -    padding-left: 18px; -    background: url(image-path('icons/remove.png')) no-repeat 0% 50%; -  } - +      } diff --git a/app/controllers/access_points_controller.rb b/app/controllers/access_points_controller.rb index 309550148..cf7507100 100644 --- a/app/controllers/access_points_controller.rb +++ b/app/controllers/access_points_controller.rb @@ -6,7 +6,6 @@ class AccessPointsController < ChouetteController    end    respond_to :html, :kml, :xml, :json -  layout "without_sidebar", :only => [:edit, :update]    def index          request.format.kml? ? @per_page = nil : @per_page = 12 diff --git a/app/controllers/chouette_controller.rb b/app/controllers/chouette_controller.rb index f9f832f37..6ef699d5b 100644 --- a/app/controllers/chouette_controller.rb +++ b/app/controllers/chouette_controller.rb @@ -4,6 +4,8 @@ class ChouetteController < InheritedResources::Base    before_filter :switch_referential +  layout "without_sidebar", :only => [:edit, :new, :update, :create] +      def switch_referential      Apartment::Database.switch(referential.slug)    end  diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb index 2107adba0..80723dc02 100644 --- a/app/controllers/stop_areas_controller.rb +++ b/app/controllers/stop_areas_controller.rb @@ -10,8 +10,6 @@ class StopAreasController < ChouetteController    respond_to :html, :kml, :xml, :json -  layout "without_sidebar", :only => [:edit, :update] -    # def complete    #   @stop_areas = line.stop_areas    #   render :layout => false diff --git a/app/views/time_tables/_date_fields.erb b/app/views/time_tables/_date_fields.erb index 1ea9b17f4..2702e8e52 100644 --- a/app/views/time_tables/_date_fields.erb +++ b/app/views/time_tables/_date_fields.erb @@ -1,5 +1,6 @@ -<%= f.inputs :class => 'dates nested-fields' do %> -  <%= f.input :date, :as => :date_picker, :label => @time_table.human_attribute_name("date"), :wrapper_html => { :class => 'fl1' }%> +<%= f.inputs :class => 'nested-fields date' do %> +  <%= f.label @time_table.human_attribute_name("date"), :class => 'col-md-1' %> +  <%= f.input :date, :as => :date_picker, :label => false, :input_html => { :class => 'form-control col-md-3' }%>    <%= f.input :in_out, :as => :hidden, :input_html => {:value => true} %> -  <%= link_to_remove_association t('actions.destroy'), f %> +  <%= link_to_remove_association t('actions.destroy'), f, :class => "col-md-3" %>  <% end %> diff --git a/app/views/time_tables/_excluded_date_fields.erb b/app/views/time_tables/_excluded_date_fields.erb index d91103ede..2302cb711 100644 --- a/app/views/time_tables/_excluded_date_fields.erb +++ b/app/views/time_tables/_excluded_date_fields.erb @@ -1,5 +1,6 @@ -<%= f.inputs :class => 'dates1 nested-fields' do %> -  <%= f.input :date, :as => :date_picker, :label => @time_table.human_attribute_name("date"), :wrapper_html => { :class => 'fl1' }%> +<%= f.inputs :class => 'nested-fields date' do %> +  <%= f.label @time_table.human_attribute_name("date"), :class => 'col-md-1' %>   +  <%= f.input :date, :as => :date_picker, :label => false, :input_html => { :class => 'form-control col-md-3' } %>    <%= f.input :in_out, :as => :hidden, :input_html => {:value => false} %> -  <%= link_to_remove_association t('actions.destroy'), f %> +  <%= link_to_remove_association t('actions.destroy'), f, :class => "col-md-3" %>  <% end %> diff --git a/app/views/time_tables/_form.erb b/app/views/time_tables/_form.erb index 252b3f6f2..6a50e9edb 100644 --- a/app/views/time_tables/_form.erb +++ b/app/views/time_tables/_form.erb @@ -3,7 +3,7 @@      <%= form.input :comment %>      <%= form.input :version %> -    <%= form.input :tag_search, :input_html => { class: "tm-input typeahead", :placeholder => "Blabla" } %> +    <%= form.input :tag_search, :input_html => { class: "tm-input typeahead", :placeholder => t("formtastic.placeholders.time_table.tag_search") } %>      <%= form.input :tag_list, :as => :hidden, :input_html => { :id => "tag_list" } %>      <%= form.input :objectid, :required => !@time_table.new_record? %>   @@ -21,7 +21,7 @@      </a>    </h3> -  <div class="periods content"  id="periods_content"> +  <div id="periods_content">  	  <%= form.inputs :class => 'day_type' do %>   	    <label class="day_type_label"><%= @time_table.human_attribute_name("day_types") %></label>  	    <%= form.input :monday, :as => :boolean, :class => "others" %>  @@ -43,20 +43,19 @@    </div>    <h3 class="time_table_dates"> -	<a class="dates"><%= @time_table.human_attribute_name("dates") %> +	  <a class="dates"><%= @time_table.human_attribute_name("dates") %>        <%= image_tag("icons/plus.png"  , :class => "switcher", :style => "display: none;") %>        <%= image_tag("icons/minus.png"  , :class => "switcher" ) %>      </a>    </h3> - -  <div class="dates content"  id="dates_content"> -	  <div id="dates"> +  <div id="dates_content"> +    <div id="dates">  		  <%= form.semantic_fields_for :dates, @time_table.dates.where("in_out = true").to_a do |p| %> -			     <%= render "date_fields",  :f => p %>  +	  	<%= render "date_fields",  :f => p %>   		  <% end %>  	  </div>  	  <%= link_to_add_association t("time_tables.actions.add_date"), form, :dates , -	  :"data-association-insertion-method" => "append", +	      :"data-association-insertion-method" => "append",  	  :"partial" => "date_fields",  	  :"data-association-insertion-node" => "div#dates" %>    </div> @@ -67,24 +66,22 @@        <%= image_tag("icons/minus.png"  , :class => "switcher" ) %>      </a>    </h3> - -  <div class="excluded_dates content"  id="dates_content"> -	  <div id="excluded"> +  <div id="excluded_dates_content"> +	  <div id="excluded_dates">  		  <%= form.semantic_fields_for :dates, @time_table.dates.where("in_out = false").to_a do |p| %> -			     <%= render "excluded_date_fields",  :f => p %>  +		  <%= render "excluded_date_fields",  :f => p %>   		  <% end %>  	  </div>  	  <%= link_to_add_association t("time_tables.actions.add_excluded_date"), form, :dates ,  	  :"data-association-insertion-method" => "append",  	  :"partial" => "excluded_date_fields", -	  :"data-association-insertion-node" => "div#excluded" %> +	  :"data-association-insertion-node" => "div#excluded_dates" %>    </div> -  <p/> -   <%= form.actions do %> -     <%= form.action :submit, :as => :button %> -     <%= form.action :cancel, :as => :link %> -   <% end %> +  <%= form.actions do %> +    <%= form.action :submit, :as => :button %> +    <%= form.action :cancel, :as => :link %> +  <% end %>  <% end %>  <%= javascript_tag "var items = #{ @time_table.tag_list.to_a };" %> @@ -99,7 +96,6 @@    var time_tables_tag_list = new Bloodhound({      datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),      queryTokenizer: Bloodhound.tokenizers.whitespace, -    prefetch: '<%= tags_referential_time_tables_path(@referential, :format => 'json') %>',      remote: '<%= tags_referential_time_tables_path(@referential, :format => 'json') %>?tag=%QUERY',    }); diff --git a/app/views/time_tables/_period_fields.erb b/app/views/time_tables/_period_fields.erb index 120a526bb..0094008f1 100644 --- a/app/views/time_tables/_period_fields.erb +++ b/app/views/time_tables/_period_fields.erb @@ -1,5 +1,7 @@ -<%= f.inputs :class => 'periods nested-fields' do %>  -  <%= f.input :period_start, :as => :date_picker, :label => @time_table.human_attribute_name("period_start"), :wrapper_html => { :class => 'fl1' }%> -  <%= f.input :period_end, :as => :date_picker, :label => @time_table.human_attribute_name("period_end"), :wrapper_html => { :class => 'fl2' }%> -  <%= link_to_remove_association t('actions.destroy'), f %> +<%= f.inputs :class => 'nested-fields period' do %> +  <%= f.label @time_table.human_attribute_name("period_start"), :class => "col-md-1" %> +  <%= f.input :period_start, :as => :date_picker, :label => false, :input_html => { :class => 'form-control col-md-3' }%> +    <%= f.label @time_table.human_attribute_name("period_end"), :class => "col-md-1" %>        +  <%= f.input :period_end, :as => :date_picker, :label => false, :input_html => { :class => 'form-control col-md-3' }%> +  <%= link_to_remove_association t('actions.destroy'), f, :class => "col-md-2" %>  <% end %> diff --git a/config/locales/time_tables.yml b/config/locales/time_tables.yml index f9f5339ba..e9f1bce3d 100644 --- a/config/locales/time_tables.yml +++ b/config/locales/time_tables.yml @@ -167,5 +167,9 @@ fr:      hints:        time_table:          objectid: "[prefixe]:Timetable:[clé_unique]  caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" +    placeholders: +      time_table: +        tag_search: "vacances" +            | 
