concerto_manykinds 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +13 -0
- data/README.md +13 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/concerto_manykinds/application.js +13 -0
- data/app/assets/javascripts/concerto_manykinds/manykinds.js +24 -0
- data/app/assets/stylesheets/concerto_manykinds/application.css +13 -0
- data/app/assets/stylesheets/concerto_manykinds/manykinds.css +4 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/concerto_manykinds/application_controller.rb +4 -0
- data/app/controllers/concerto_manykinds/manykinds_controller.rb +112 -0
- data/app/helpers/concerto_manykinds/application_helper.rb +4 -0
- data/app/helpers/concerto_manykinds/manykinds_helper.rb +4 -0
- data/app/models/concerto_manykinds/manykind.rb +35 -0
- data/app/views/concerto_manykinds/manykinds/index.html.erb +13 -0
- data/app/views/concerto_manykinds/templates/_details.html.erb +63 -0
- data/app/views/concerto_manykinds/templates/_item.html.erb +6 -0
- data/config/locales/en.yml +18 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20140613205731_create_concerto_manykinds.rb +11 -0
- data/lib/concerto_manykinds/engine.rb +46 -0
- data/lib/concerto_manykinds/version.rb +3 -0
- data/lib/concerto_manykinds.rb +4 -0
- data/lib/tasks/concerto_manykinds_tasks.rake +4 -0
- data/test/concerto_template_scheduling_test.rb +7 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/fixtures/concerto_template_scheduling/schedules.yml +11 -0
- data/test/functional/concerto_template_scheduling/schedules_controller_test.rb +51 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/concerto_template_scheduling/schedule_test.rb +9 -0
- data/test/unit/helpers/concerto_template_scheduling/schedules_helper_test.rb +6 -0
- metadata +170 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f8a578c19ff10c9d6fd123f3affdef4e2ad8f453
|
4
|
+
data.tar.gz: 75b85172d22fe574f536b861c1b38725a8552489
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dc316d328493893efe543aeb08d436603cbd6a57a83bff97654acb83dcd247d509a0a7524ab242f2f30810d2a85c52a14015271ab7efcd75a057ebf101bc7ed4
|
7
|
+
data.tar.gz: 0e0a6a0163e02593fffeb169ee3adca7aca4a96b7bf1ca75ca3dba8f3c44d6da6078e109644e107c3897893d58ef136825eadd86bee020005c98cf16c0e1de25
|
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2014 Marvin Frederickson
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Concerto Manykinds
|
2
|
+
|
3
|
+
A Rails Engine for displaying multiple types of content in the same template field in Concerto.
|
4
|
+
|
5
|
+
To use this engine, add the following to the Concerto Gemfile:
|
6
|
+
```
|
7
|
+
gem 'concerto_manykinds'
|
8
|
+
```
|
9
|
+
|
10
|
+
To create the proper migrations, run:
|
11
|
+
```
|
12
|
+
rails generate concerto_manykinds
|
13
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'ConcertoManykinds'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,24 @@
|
|
1
|
+
// Place all the behaviors and hooks related to the matching controller here.
|
2
|
+
// All this logic will automatically be available in application.js.
|
3
|
+
var manykinds_handlers_initialized = false;
|
4
|
+
|
5
|
+
function attachConcertoManykindsHandlers() {
|
6
|
+
if (!manykinds_handlers_initialized) {
|
7
|
+
$('ul.manykinds-list').on('ajax:success', 'a[data-method="delete"]', function (e, data, status, xhr) {
|
8
|
+
console.debug('firing');
|
9
|
+
$(this).parent('li').hide();
|
10
|
+
});
|
11
|
+
|
12
|
+
$('form[id="new_manykind"]').on('ajax:success', function (e, data, status, xhr) {
|
13
|
+
// show the new item
|
14
|
+
$("#manykinds_fld" + data["field_id"]).append(data["item_html"]);
|
15
|
+
});
|
16
|
+
|
17
|
+
console.debug('manykinds handlers initialized');
|
18
|
+
manykinds_handlers_initialized = true;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
$(document).ready(attachConcertoManykindsHandlers);
|
23
|
+
$(document).on('page:change', attachConcertoManykindsHandlers);
|
24
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,56 @@
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
2
|
+
|
3
|
+
body, p, ol, ul, td {
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
pre {
|
10
|
+
background-color: #eee;
|
11
|
+
padding: 10px;
|
12
|
+
font-size: 11px;
|
13
|
+
}
|
14
|
+
|
15
|
+
a { color: #000; }
|
16
|
+
a:visited { color: #666; }
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
18
|
+
|
19
|
+
div.field, div.actions {
|
20
|
+
margin-bottom: 10px;
|
21
|
+
}
|
22
|
+
|
23
|
+
#notice {
|
24
|
+
color: green;
|
25
|
+
}
|
26
|
+
|
27
|
+
.field_with_errors {
|
28
|
+
padding: 2px;
|
29
|
+
background-color: red;
|
30
|
+
display: table;
|
31
|
+
}
|
32
|
+
|
33
|
+
#error_explanation {
|
34
|
+
width: 450px;
|
35
|
+
border: 2px solid red;
|
36
|
+
padding: 7px;
|
37
|
+
padding-bottom: 0;
|
38
|
+
margin-bottom: 20px;
|
39
|
+
background-color: #f0f0f0;
|
40
|
+
}
|
41
|
+
|
42
|
+
#error_explanation h2 {
|
43
|
+
text-align: left;
|
44
|
+
font-weight: bold;
|
45
|
+
padding: 5px 5px 5px 15px;
|
46
|
+
font-size: 12px;
|
47
|
+
margin: -7px;
|
48
|
+
margin-bottom: 0px;
|
49
|
+
background-color: #c00;
|
50
|
+
color: #fff;
|
51
|
+
}
|
52
|
+
|
53
|
+
#error_explanation ul li {
|
54
|
+
font-size: 12px;
|
55
|
+
list-style: square;
|
56
|
+
}
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require_dependency "concerto_manykinds/application_controller"
|
2
|
+
|
3
|
+
module ConcertoManykinds
|
4
|
+
class ManykindsController < ApplicationController
|
5
|
+
|
6
|
+
# # GET /schedules
|
7
|
+
# # GET /schedules.json
|
8
|
+
# def index
|
9
|
+
# @schedules = Schedule.all
|
10
|
+
# # ignore the schedules that belong to screens we cant read
|
11
|
+
# # or schedules where the template has been deleted
|
12
|
+
# @schedules.reject! { |s| !can?(:read, s.screen) || s.template.nil? }
|
13
|
+
|
14
|
+
# respond_to do |format|
|
15
|
+
# format.html # index.html.erb
|
16
|
+
# format.json { render json: @schedules }
|
17
|
+
# end
|
18
|
+
# end
|
19
|
+
|
20
|
+
# # GET /schedules/1
|
21
|
+
# # GET /schedules/1.json
|
22
|
+
# def show
|
23
|
+
# @schedule = Schedule.find(params[:id])
|
24
|
+
# auth! :action => :read, :object => @schedule.screen
|
25
|
+
|
26
|
+
# respond_to do |format|
|
27
|
+
# format.html # show.html.erb
|
28
|
+
# format.json { render json: @schedule }
|
29
|
+
# end
|
30
|
+
# end
|
31
|
+
|
32
|
+
# # GET /schedules/new
|
33
|
+
# # GET /schedules/new.json
|
34
|
+
# def new
|
35
|
+
# @schedule = Schedule.new
|
36
|
+
# if !params[:screen_id].nil?
|
37
|
+
# # TODO: Error handling
|
38
|
+
# @schedule.screen = Screen.find(params[:screen_id])
|
39
|
+
# end
|
40
|
+
# auth! :action => :update, :object => @schedule.screen
|
41
|
+
|
42
|
+
# respond_to do |format|
|
43
|
+
# format.html # new.html.erb
|
44
|
+
# format.json { render json: @schedule }
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
|
48
|
+
# # GET /schedules/1/edit
|
49
|
+
# def edit
|
50
|
+
# @schedule = Schedule.find(params[:id])
|
51
|
+
# auth! :action => :update, :object => @schedule.screen
|
52
|
+
# end
|
53
|
+
|
54
|
+
# POST /schedules
|
55
|
+
# POST /schedules.json
|
56
|
+
def create
|
57
|
+
@manykind = Manykind.new(manykind_params)
|
58
|
+
auth! :action => :update, :object => @manykind.template
|
59
|
+
respond_to do |format|
|
60
|
+
if @manykind.save
|
61
|
+
format.html { redirect_to @manykind, notice: 'Kind was successfully created.' }
|
62
|
+
#format.json { render json: @manykind, status: :created, location: @manykind }
|
63
|
+
format.json do
|
64
|
+
item_html = render_to_string(:partial => 'concerto_manykinds/templates/item', :object => @manykind, :formats => [:html])
|
65
|
+
render json: { :field_id => @manykind.field.id, :item_html => item_html }, status: :created, location: @manykind
|
66
|
+
end
|
67
|
+
else
|
68
|
+
format.html { render action: "new" }
|
69
|
+
format.json { render json: @manykind.errors, status: :unprocessable_entity }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# # PUT /schedules/1
|
75
|
+
# # PUT /schedules/1.json
|
76
|
+
# def update
|
77
|
+
# @schedule = Schedule.find(params[:id])
|
78
|
+
# auth! :action => :update, :object => @schedule.screen
|
79
|
+
|
80
|
+
# respond_to do |format|
|
81
|
+
# if @schedule.update_attributes(schedule_params)
|
82
|
+
# process_notification(@schedule, {:screen_id => @schedule.screen_id, :screen_name => @schedule.screen.name,
|
83
|
+
# :template_id => @schedule.template.id, :template_name => @schedule.template.name },
|
84
|
+
# :key => 'concerto_template_scheduling.schedule.update', :owner => current_user, :action => 'update')
|
85
|
+
|
86
|
+
# format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }
|
87
|
+
# format.json { head :no_content }
|
88
|
+
# else
|
89
|
+
# format.html { render action: "edit" }
|
90
|
+
# format.json { render json: @schedule.errors, status: :unprocessable_entity }
|
91
|
+
# end
|
92
|
+
# end
|
93
|
+
# end
|
94
|
+
|
95
|
+
# DELETE /schedules/1
|
96
|
+
# DELETE /schedules/1.json
|
97
|
+
def destroy
|
98
|
+
@manykind = Manykind.find(params[:id])
|
99
|
+
auth! :action => :update, :object => @manykind.template
|
100
|
+
@manykind.destroy
|
101
|
+
|
102
|
+
respond_to do |format|
|
103
|
+
format.html { redirect_to manykindsengine.manykinds_url }
|
104
|
+
format.json { head :no_content }
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def manykind_params
|
109
|
+
params.require(:manykind).permit(*ConcertoManykinds::Manykind.form_attributes)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module ConcertoManykinds
|
2
|
+
class Manykind < ActiveRecord::Base
|
3
|
+
include ActiveModel::ForbiddenAttributesProtection
|
4
|
+
|
5
|
+
belongs_to :field
|
6
|
+
belongs_to :kind
|
7
|
+
belongs_to :template
|
8
|
+
|
9
|
+
validates :field_id, :presence => true
|
10
|
+
validates :kind_id, :presence => true
|
11
|
+
validates :template_id, :presence => true
|
12
|
+
validates_uniqueness_of :kind_id, :scope => [:template_id, :field_id]
|
13
|
+
|
14
|
+
# TODO dont allow record if already exists in position field mapping
|
15
|
+
validate :cannot_be_same_as_primary
|
16
|
+
|
17
|
+
def cannot_be_same_as_primary
|
18
|
+
if template_id.present? && field_id.present? && kind_id.present?
|
19
|
+
p = Position.where(:template_id => template_id, :field_id => field_id).first
|
20
|
+
if !p.nil? and p.field.kind_id == kind_id
|
21
|
+
errors.add(:kind_id, 'already mapped via template definition')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.form_attributes
|
27
|
+
attributes = [:field_id, :template_id, :kind_id]
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.kinds_for(template_id, field_id)
|
31
|
+
Manykind.where(:template_id => template_id, :field_id => field_id)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<section class="viewblock">
|
2
|
+
<header class="viewblock-header">
|
3
|
+
<div class="viewblock-header_right">
|
4
|
+
<div class="button-padding">
|
5
|
+
</div>
|
6
|
+
</div>
|
7
|
+
<h1 class="default-padding">
|
8
|
+
<%= t(:all_model, :model => ConcertoManykinds::Manykind.model_name.human.pluralize) %>
|
9
|
+
</h1>
|
10
|
+
</header>
|
11
|
+
<div class="viewblock-cont">
|
12
|
+
</div>
|
13
|
+
</section>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<%= stylesheet_link_tag "concerto_manykinds/application" %>
|
2
|
+
<%= javascript_include_tag "concerto_manykinds/application" %>
|
3
|
+
<section class="viewblock">
|
4
|
+
<header class="viewblock-header">
|
5
|
+
|
6
|
+
<div class="viewblock-header_right">
|
7
|
+
<div class="button-padding">
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="default-padding">
|
12
|
+
<h1>
|
13
|
+
<%= t('.additional_kinds_per_field') %>
|
14
|
+
</h1>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
</header>
|
18
|
+
<div class="viewblock-cont">
|
19
|
+
<div class="row-fluid">
|
20
|
+
<div class="span12">
|
21
|
+
<div class="default-padding">
|
22
|
+
<div class="subblock">
|
23
|
+
<div class="default-padding clearfix">
|
24
|
+
<% @template.positions.each do |p| %>
|
25
|
+
<h3><%= "#{p.field.name} #{t('.field')}" %></h3>
|
26
|
+
<ul class="list-stacked manykinds-list" id="manykinds_fld<%=p.field.id%>">
|
27
|
+
<li><%= p.field.kind.name %> <i class='icon-star' title="<%=t('.fundamental_kind')%>"></i></li>
|
28
|
+
<% @manykinds.each do |m| %>
|
29
|
+
<% if m.field.id == p.field.id %>
|
30
|
+
<%= render :partial => 'concerto_manykinds/templates/item', :object => m %>
|
31
|
+
<% end %>
|
32
|
+
<% end %>
|
33
|
+
</ul>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<% if can? :update, @template %>
|
37
|
+
<div class="row-fluid">
|
38
|
+
<%= form_for(@manykind_new, :url => manykindsengine.manykinds_path, :html => { 'data-type' => 'json'}, :remote => true, :class => 'form', :format => 'json') do |f| %>
|
39
|
+
<%= f.hidden_field :template_id, :value => @template.id %>
|
40
|
+
<div class="span4">
|
41
|
+
<%= f.label :field_id %>
|
42
|
+
<%= f.collection_select :field_id, Field.all, :id, :name %>
|
43
|
+
</div>
|
44
|
+
<div class="span4">
|
45
|
+
<%= f.label :kind_id %>
|
46
|
+
<%= f.collection_select :kind_id, Kind.all, :id, :name %>
|
47
|
+
</div>
|
48
|
+
<div class="span2">
|
49
|
+
<label> </label>
|
50
|
+
<%= f.button t(:add), :class => 'btn btn-small' %>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
<% end %>
|
54
|
+
<% end %>
|
55
|
+
|
56
|
+
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
</section>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<li>
|
2
|
+
<%= item.kind.name %>
|
3
|
+
<% if can? :update, item.template %>
|
4
|
+
<%= link_to t(:destroy), manykindsengine.manykind_path(item), :data => { :confirm => t(:are_you_sure_delete_model_key, :model => ConcertoManykinds::Manykind.model_name.human, :key => item.kind.name), :type => 'json' }, :method => :delete, :class => "btn btn-small", :remote => true %>
|
5
|
+
<% end %>
|
6
|
+
</li>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
en:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
concerto_manykinds/manykind: 'Kinds'
|
5
|
+
attributes:
|
6
|
+
concerto_manykinds/manykind:
|
7
|
+
field_id: 'Field'
|
8
|
+
template_id: 'Template'
|
9
|
+
kind_id: 'Kind'
|
10
|
+
|
11
|
+
concerto_manykinds:
|
12
|
+
are_you_sure_delete: 'Are you sure you want to remove the mapping of the %{kind} from the %{field} field?'
|
13
|
+
|
14
|
+
templates:
|
15
|
+
details:
|
16
|
+
field: "Field"
|
17
|
+
additional_kinds_per_field: "Additional Kinds"
|
18
|
+
fundamental_kind: "This kind was added during the import of the template and cannot be removed."
|
data/config/routes.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
module ConcertoManykinds
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace ConcertoManykinds
|
4
|
+
|
5
|
+
# The engine name will be the name of the class
|
6
|
+
# that contains the URL helpers for our routes.
|
7
|
+
engine_name 'manykindsengine'
|
8
|
+
|
9
|
+
def plugin_info(plugin_info_class)
|
10
|
+
@plugin_info ||= plugin_info_class.new do
|
11
|
+
|
12
|
+
# Make the engine's controller accessible at /manykinds
|
13
|
+
add_route("manykinds", ConcertoManykinds::Engine)
|
14
|
+
|
15
|
+
# Some code to run at app boot
|
16
|
+
init do
|
17
|
+
Rails.logger.info "ConcertoManykinds: Initialization code is running"
|
18
|
+
end
|
19
|
+
|
20
|
+
# show the details alongside each template
|
21
|
+
|
22
|
+
add_controller_hook "TemplatesController", :show, :before do
|
23
|
+
@manykinds = Manykind.where(:template_id => @template.id)
|
24
|
+
@manykind_new = Manykind.new
|
25
|
+
end
|
26
|
+
|
27
|
+
add_view_hook "TemplatesController", :sidebar, :partial => "concerto_manykinds/templates/details"
|
28
|
+
|
29
|
+
# # show that the template is in use
|
30
|
+
|
31
|
+
# add_controller_hook "TemplatesController", :show, :before do
|
32
|
+
# @schedules = Schedule.where(:template_id => @template.id)
|
33
|
+
# end
|
34
|
+
|
35
|
+
# add_view_hook "TemplatesController", :template_details, :partial => "concerto_template_scheduling/templates/in_use_by"
|
36
|
+
|
37
|
+
# override the filtering by using an around filter and not yielding to it
|
38
|
+
add_controller_hook "Subscription", :filter_contents, :around do
|
39
|
+
allowed_kinds = Manykind.kinds_for(self.screen.template.id, self.field.id).collect {|r| r.kind_id }
|
40
|
+
allowed_kinds << self.field.kind.id
|
41
|
+
@contents.reject!{|c| !allowed_kinds.include?(c.kind_id)}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/test/dummy/bin/rake
ADDED