aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorEdouard Maffert2016-05-12 17:14:18 +0200
committerEdouard Maffert2016-05-12 17:14:18 +0200
commit020cf3b06409acae569c23636ee91085fbeb5699 (patch)
treea93afd432db99174c8f10c33edb22226cca2c084 /app
parent972bbcb308d360c5468cd629dc5cdf356d556a2e (diff)
downloadchouette-core-020cf3b06409acae569c23636ee91085fbeb5699.tar.bz2
add offer workbench model #827
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/offer_workbenches.js.coffee3
-rw-r--r--app/assets/stylesheets/main/offer_workbenches.scss3
-rw-r--r--app/controllers/offer_workbenches_controller.rb12
-rw-r--r--app/helpers/offer_workbenches_helper.rb2
-rw-r--r--app/models/offer_workbench.rb7
-rw-r--r--app/models/organisation.rb2
-rw-r--r--app/views/offer_workbenches/show.html.erb1
-rw-r--r--app/views/referentials/index.html.erb6
8 files changed, 36 insertions, 0 deletions
diff --git a/app/assets/javascripts/offer_workbenches.js.coffee b/app/assets/javascripts/offer_workbenches.js.coffee
new file mode 100644
index 000000000..24f83d18b
--- /dev/null
+++ b/app/assets/javascripts/offer_workbenches.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/stylesheets/main/offer_workbenches.scss b/app/assets/stylesheets/main/offer_workbenches.scss
new file mode 100644
index 000000000..2859c635d
--- /dev/null
+++ b/app/assets/stylesheets/main/offer_workbenches.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the offer_workbenches controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/controllers/offer_workbenches_controller.rb b/app/controllers/offer_workbenches_controller.rb
new file mode 100644
index 000000000..b9663184b
--- /dev/null
+++ b/app/controllers/offer_workbenches_controller.rb
@@ -0,0 +1,12 @@
+class OfferWorkbenchesController < BreadcrumbController
+
+ defaults :resource_class => OfferWorkbench
+ respond_to :html, :only => [:show]
+
+ def show
+ show! do
+ build_breadcrumb :show
+ end
+ end
+
+end
diff --git a/app/helpers/offer_workbenches_helper.rb b/app/helpers/offer_workbenches_helper.rb
new file mode 100644
index 000000000..1590ec132
--- /dev/null
+++ b/app/helpers/offer_workbenches_helper.rb
@@ -0,0 +1,2 @@
+module OfferWorkbenchesHelper
+end
diff --git a/app/models/offer_workbench.rb b/app/models/offer_workbench.rb
new file mode 100644
index 000000000..2288d5bbb
--- /dev/null
+++ b/app/models/offer_workbench.rb
@@ -0,0 +1,7 @@
+class OfferWorkbench < ActiveRecord::Base
+ belongs_to :organisation
+
+ validates :name, presence: true, uniqueness: true
+ validates :organisation, presence: true
+
+end
diff --git a/app/models/organisation.rb b/app/models/organisation.rb
index 4d098dbd3..9d6e92825 100644
--- a/app/models/organisation.rb
+++ b/app/models/organisation.rb
@@ -12,6 +12,8 @@ class Organisation < ActiveRecord::Base
has_many :line_referential_memberships
has_many :line_referentials, through: :line_referential_memberships
+ has_many :offer_workbenches
+
validates :name, :presence => true, :uniqueness => true
after_create :add_rule_parameter_set
diff --git a/app/views/offer_workbenches/show.html.erb b/app/views/offer_workbenches/show.html.erb
new file mode 100644
index 000000000..c7c2ea896
--- /dev/null
+++ b/app/views/offer_workbenches/show.html.erb
@@ -0,0 +1 @@
+<%= title_tag @offer_workbench.name %> \ No newline at end of file
diff --git a/app/views/referentials/index.html.erb b/app/views/referentials/index.html.erb
index cb84f39cc..c3ea18898 100644
--- a/app/views/referentials/index.html.erb
+++ b/app/views/referentials/index.html.erb
@@ -1,3 +1,9 @@
+<!-- FIXME #827 -->
+<ul>
+ <% current_organisation.offer_workbenches.try(:each) do |offer| %>
+ <li><h2><%= link_to offer.name, offer %></h2></li>
+ <% end %>
+</ul>
<!-- FIXME #823 -->
<% if false %>