diff options
| -rw-r--r-- | app/assets/images/favicon.ico | bin | 0 -> 1406 bytes | |||
| -rw-r--r-- | app/controllers/referentials_controller.rb | 1 | ||||
| -rw-r--r-- | app/inputs/full_time_zone_input.rb | 21 | ||||
| -rw-r--r-- | app/models/referential.rb | 5 | ||||
| -rw-r--r-- | app/views/companies/edit.html.slim | 7 | ||||
| -rw-r--r-- | app/views/companies/new.html.slim | 3 | ||||
| -rw-r--r-- | app/views/layouts/application.html.slim | 2 | ||||
| -rw-r--r-- | app/views/workbenches/show.html.slim | 5 | ||||
| -rw-r--r-- | db/migrate/20180502075142_revert_routing_constraint_zones_stop_ids_type.rb | 8 | ||||
| -rw-r--r-- | public/favicon.ico | bin | 0 -> 1406 bytes | |||
| -rw-r--r-- | spec/controllers/referentials_controller_spec.rb | 1 | ||||
| -rw-r--r-- | spec/features/workbenches/workbenches_show_spec.rb | 21 | ||||
| -rw-r--r-- | spec/models/referential/referential_oid_format_from_wkbch_spec.rb | 3 | ||||
| -rw-r--r-- | spec/models/referential_spec.rb | 1 |
14 files changed, 65 insertions, 13 deletions
diff --git a/app/assets/images/favicon.ico b/app/assets/images/favicon.ico Binary files differnew file mode 100644 index 000000000..ac6bc298d --- /dev/null +++ b/app/assets/images/favicon.ico diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index 8addfbc32..80f954cde 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -136,7 +136,6 @@ class ReferentialsController < ChouetteController def create_resource(referential) referential.organisation = current_organisation - referential.ready = true super end diff --git a/app/inputs/full_time_zone_input.rb b/app/inputs/full_time_zone_input.rb index f5d8a9ba2..6138d17f5 100644 --- a/app/inputs/full_time_zone_input.rb +++ b/app/inputs/full_time_zone_input.rb @@ -1,7 +1,20 @@ class FullTimeZoneInput < SimpleForm::Inputs::CollectionSelectInput def collection @collection ||= begin - collection = options.delete(:collection) || ActiveSupport::TimeZone::MAPPING + collection = options.delete(:collection) || begin + coll = {} + + TZInfo::Timezone.all_data_zones.map do |tzinfo| + # v = ActiveSupport::TimeZone.zones_map[k] + # coll.sort_by do |v| + # "(#{v.formatted_offset}) #{v.name}" + # end + next if tzinfo.friendly_identifier =~ /^etc/i + tz = ActiveSupport::TimeZone.new tzinfo.name#, nil, tzinfo + coll[[tz.utc_offset, tzinfo.friendly_identifier(true)]] = ["(#{tz.formatted_offset}) #{tzinfo.friendly_identifier(true)}", tz.name] + end + coll.sort.map(&:last) + end collection.respond_to?(:call) ? collection.call : collection.to_a end end @@ -9,12 +22,8 @@ class FullTimeZoneInput < SimpleForm::Inputs::CollectionSelectInput def detect_collection_methods label, value = options.delete(:label_method), options.delete(:value_method) - label ||= ->(tz) do - tz = ActiveSupport::TimeZone[tz.last] - "(#{tz.formatted_offset}) #{tz.name}" - end + label ||= :first value ||= :last - [label, value] end diff --git a/app/models/referential.rb b/app/models/referential.rb index 933bc78e3..b4f64fad1 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -59,7 +59,6 @@ class Referential < ApplicationModel belongs_to :referential_suite - scope :pending, -> { where(ready: false, failed_at: nil, archived_at: nil) } scope :active, -> { where(ready: true, failed_at: nil, archived_at: nil) } scope :failed, -> { where.not(failed_at: nil) } @@ -271,7 +270,8 @@ class Referential < ApplicationModel stop_area_referential: from.stop_area_referential, created_from: from, objectid_format: from.objectid_format, - metadatas: from.metadatas.map { |m| ReferentialMetadata.new_from(m, organisation) } + metadatas: from.metadatas.map { |m| ReferentialMetadata.new_from(m, organisation) }, + ready: false ) end @@ -471,6 +471,7 @@ class Referential < ApplicationModel end def destroy_schema + return unless ActiveRecord::Base.connection.schema_names.include?(slug) Apartment::Tenant.drop slug end diff --git a/app/views/companies/edit.html.slim b/app/views/companies/edit.html.slim index faa88f829..c85bef0ec 100644 --- a/app/views/companies/edit.html.slim +++ b/app/views/companies/edit.html.slim @@ -1,3 +1,8 @@ - breadcrumb :company, @company - page_header_content_for @company -= render 'form'
\ No newline at end of file + +.page_content + .container-fluid + .row + .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 + = render 'form' diff --git a/app/views/companies/new.html.slim b/app/views/companies/new.html.slim index 1747b8e10..6cc32130d 100644 --- a/app/views/companies/new.html.slim +++ b/app/views/companies/new.html.slim @@ -1,6 +1,7 @@ - breadcrumb :companies, @line_referential + .page_content .container-fluid .row .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 - = render 'form'
\ No newline at end of file + = render 'form' diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index abf39c089..596627996 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -8,6 +8,8 @@ html lang=I18n.locale title = t('brandname') + = favicon_link_tag + = stylesheet_link_tag 'base' = stylesheet_link_tag 'application' diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim index b0276c5ce..213c9e5f2 100644 --- a/app/views/workbenches/show.html.slim +++ b/app/views/workbenches/show.html.slim @@ -62,7 +62,10 @@ attribute: Proc.new {|w| w.merged_at ? l(w.merged_at, format: :short) : '-'} \ ) \ ], - selectable: ->(ref){ @workbench.referentials.include?(ref) }, + selectable: ->(ref) { \ + @workbench.referentials.include?(ref) && \ + !ref.pending? \ + }, cls: 'table has-filter has-search', action: :index diff --git a/db/migrate/20180502075142_revert_routing_constraint_zones_stop_ids_type.rb b/db/migrate/20180502075142_revert_routing_constraint_zones_stop_ids_type.rb new file mode 100644 index 000000000..e5213a520 --- /dev/null +++ b/db/migrate/20180502075142_revert_routing_constraint_zones_stop_ids_type.rb @@ -0,0 +1,8 @@ +class RevertRoutingConstraintZonesStopIdsType < ActiveRecord::Migration + def change + reversible do |dir| + dir.up { change_column :routing_constraint_zones, :stop_point_ids, :bigint, array: true } + dir.down { change_column :routing_constraint_zones, :stop_point_ids, :integer, array: true } + end + end +end diff --git a/public/favicon.ico b/public/favicon.ico Binary files differnew file mode 100644 index 000000000..ac6bc298d --- /dev/null +++ b/public/favicon.ico diff --git a/spec/controllers/referentials_controller_spec.rb b/spec/controllers/referentials_controller_spec.rb index acab3abd9..8edd8699f 100644 --- a/spec/controllers/referentials_controller_spec.rb +++ b/spec/controllers/referentials_controller_spec.rb @@ -119,6 +119,7 @@ describe ReferentialsController, :type => :controller do it "creates the new referential" do expect{request}.to change{Referential.count}.by 1 expect(Referential.last.name).to eq "Duplicated" + expect(Referential.last.state).to eq :pending end it "displays a flash message" do diff --git a/spec/features/workbenches/workbenches_show_spec.rb b/spec/features/workbenches/workbenches_show_spec.rb index 441f829a1..427b526cf 100644 --- a/spec/features/workbenches/workbenches_show_spec.rb +++ b/spec/features/workbenches/workbenches_show_spec.rb @@ -64,6 +64,27 @@ RSpec.describe 'Workbenches', type: :feature do "Couldn't find `hidden_referential`: `#{hidden_referential.inspect}`" end + it "prevents pending referentials from being selected" do + line = create(:line, line_referential: line_ref) + metadata = create(:referential_metadata, lines: [line]) + pending_referential = create( + :workbench_referential, + workbench: workbench, + metadatas: [metadata], + organisation: @user.organisation, + ready: false + ) + + visit workbench_path(workbench) + + expect( + find("input[type='checkbox'][value='#{referential.id}']") + ).not_to be_disabled + expect( + find("input[type='checkbox'][value='#{pending_referential.id}']") + ).to be_disabled + end + context 'filtering' do let!(:another_organisation) { create :organisation } let(:another_line) { create :line, line_referential: line_ref } diff --git a/spec/models/referential/referential_oid_format_from_wkbch_spec.rb b/spec/models/referential/referential_oid_format_from_wkbch_spec.rb index 6783ab55d..a693e80c9 100644 --- a/spec/models/referential/referential_oid_format_from_wkbch_spec.rb +++ b/spec/models/referential/referential_oid_format_from_wkbch_spec.rb @@ -58,7 +58,8 @@ RSpec.describe Referential do stop_area_referential: source.stop_area_referential, created_from: source, objectid_format: source.objectid_format, - metadatas: source.metadatas.map { |m| ReferentialMetadata.new_from(m, functional_scope) }) + metadatas: source.metadatas.map { |m| ReferentialMetadata.new_from(m, functional_scope) }, + ready: false) described_class.new_from( source, functional_scope ) end diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb index eb9c2e338..720cec48c 100644 --- a/spec/models/referential_spec.rb +++ b/spec/models/referential_spec.rb @@ -203,6 +203,7 @@ describe Referential, :type => :model do it 'should create a Referential' do ref expect { saved_clone }.to change{Referential.count}.by(1) + expect(saved_clone.state).to eq :pending end xit 'should create a ReferentialCloning' do |
