promethee 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +164 -19
  3. data/Rakefile +33 -2
  4. data/app/assets/images/icon-promethee.png +0 -0
  5. data/app/assets/images/logo-promethee-horizontal.svg +14 -0
  6. data/app/assets/images/logo-promethee-vertical.svg +14 -0
  7. data/app/assets/javascripts/promethee.js +59 -0
  8. data/app/assets/javascripts/promethee/controller.js +22 -0
  9. data/app/assets/stylesheets/promethee-editor.sass +105 -0
  10. data/app/assets/stylesheets/promethee-editor/_mixins.sass +19 -0
  11. data/app/assets/stylesheets/promethee-editor/_variables.sass +4 -0
  12. data/app/assets/stylesheets/promethee.sass +4 -0
  13. data/app/views/promethee/_edit.html.erb +172 -0
  14. data/app/views/promethee/_show.html.erb +6 -0
  15. data/app/views/promethee/components/_column.html.erb +8 -0
  16. data/app/views/promethee/components/_column_edit.html.erb +40 -0
  17. data/app/views/promethee/components/_image.html.erb +7 -0
  18. data/app/views/promethee/components/_image_edit.html.erb +60 -0
  19. data/app/views/promethee/components/_index.html.erb +3 -0
  20. data/app/views/promethee/components/_index_edit.html.erb +7 -0
  21. data/app/views/promethee/components/_row.html.erb +6 -0
  22. data/app/views/promethee/components/_row_edit.html.erb +53 -0
  23. data/app/views/promethee/components/_show.html.erb +4 -0
  24. data/app/views/promethee/components/_show_edit.html.erb +3 -0
  25. data/app/views/promethee/components/_text.html.erb +6 -0
  26. data/app/views/promethee/components/_text_edit.html.erb +59 -0
  27. data/app/views/promethee/components/_video.html.erb +16 -0
  28. data/app/views/promethee/components/_video_edit.html.erb +63 -0
  29. data/app/views/promethee/partials/_toolbar_buttons.html.erb +4 -0
  30. data/lib/promethee.rb +37 -2
  31. data/lib/promethee/component.rb +28 -0
  32. data/lib/promethee/component/attribute.rb +42 -0
  33. data/lib/promethee/component/attribute/boolean.rb +4 -0
  34. data/lib/promethee/component/attribute/float.rb +3 -0
  35. data/lib/promethee/component/attribute/integer.rb +3 -0
  36. data/lib/promethee/component/attribute/string.rb +3 -0
  37. data/lib/promethee/component/attributes.rb +50 -0
  38. data/lib/promethee/component/attributes/definer.rb +13 -0
  39. data/lib/promethee/component/base.rb +68 -0
  40. data/lib/promethee/component/collection.rb +17 -0
  41. data/lib/promethee/component/column.rb +8 -0
  42. data/lib/promethee/component/image.rb +6 -0
  43. data/lib/promethee/component/row.rb +3 -0
  44. data/lib/promethee/component/text.rb +5 -0
  45. data/lib/promethee/component/video.rb +5 -0
  46. data/lib/promethee/core_ext/form_builder.rb +6 -0
  47. data/lib/promethee/core_ext/form_helper.rb +6 -0
  48. data/lib/promethee/core_ext/tags.rb +18 -0
  49. data/lib/promethee/grid.rb +52 -0
  50. data/lib/promethee/rails/engine.rb +7 -0
  51. data/lib/promethee/rails/helper.rb +26 -0
  52. data/lib/promethee/rails/version.rb +5 -0
  53. data/lib/tasks/promethee/promethee.rake +4 -0
  54. metadata +202 -20
  55. data/.gitignore +0 -9
  56. data/CODE_OF_CONDUCT.md +0 -74
  57. data/Gemfile +0 -6
  58. data/LICENSE +0 -21
  59. data/bin/console +0 -14
  60. data/bin/setup +0 -8
  61. data/lib/promethee/version.rb +0 -3
  62. data/promethee.gemspec +0 -24
@@ -0,0 +1,52 @@
1
+ class Promethee::Grid
2
+ include ActionView::Helpers::FormTagHelper
3
+
4
+ attr_accessor :data, :name, :id
5
+
6
+ def initialize(data = [], name: nil, id: nil)
7
+ self.data = data
8
+ self.name = name
9
+ self.id = id.nil? ? self.class.id : id
10
+ end
11
+
12
+ def components
13
+ Promethee::Component::Collection.from data
14
+ end
15
+
16
+ # def value
17
+ # data.is_a?(String) ? data : data.to_json
18
+ # end
19
+
20
+ def input options = {}
21
+ hidden_field_tag name, '{{promethee.data}}', options
22
+ end
23
+
24
+ # def to_javascript
25
+ # <<-JAVASCRIPT.html_safe
26
+ # new Promethee(#{id.to_json}, #{data.to_json})
27
+ # JAVASCRIPT
28
+ # end
29
+ # alias_method :to_js, :to_javascript
30
+
31
+ def template(type)
32
+ ApplicationController.renderer.render partial: "/promethee/#{'components/' unless [:component, :components].include? type.to_s.to_sym }#{type}_edit", locals: { promethee: self }
33
+ end
34
+
35
+ def templates
36
+ Promethee::Component.types.map{ |type| template type }.join.html_safe
37
+ end
38
+
39
+ def edit
40
+ ApplicationController.renderer.render partial: 'promethee/edit', locals: { promethee: self }
41
+ end
42
+
43
+ def show
44
+ ApplicationController.renderer.render partial: 'promethee/show', locals: { promethee: self }
45
+ end
46
+
47
+ private
48
+
49
+ def self.id
50
+ "promethee-#{SecureRandom.hex 10}"
51
+ end
52
+ end
@@ -0,0 +1,7 @@
1
+ class Promethee::Rails::Engine < ::Rails::Engine
2
+ initializer 'helper' do |app|
3
+ ActiveSupport.on_load :action_view do
4
+ include Promethee::Rails::Helper
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,26 @@
1
+ module Promethee::Rails::Helper
2
+ def promethee(data)
3
+ ApplicationController.renderer.render partial: 'promethee/show', locals: { data: data }
4
+ end
5
+
6
+ def promethee_template(type)
7
+ render "/promethee/#{'components/' unless [:component, :components].include? type.to_s.to_sym }#{type}_edit"
8
+ end
9
+
10
+ def promethee_templates
11
+ Promethee::Component.types.map{ |type| promethee_template type }.join.html_safe
12
+ end
13
+
14
+ def promethee_class_for component
15
+ "promethee__component promethee__component--#{component[:type]}"
16
+ end
17
+
18
+ def promethee_editor_for(type)
19
+ component_class = type.to_s.classify
20
+ component = type[0].downcase + type[1..-1]
21
+
22
+ content_tag :div, 'ng-controller': "#{component_class} as #{component}", 'ng-init': "#{component}.data = data" do
23
+ concat yield(Promethee::Component.as(type))
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ module Promethee
2
+ module Rails
3
+ VERSION = "0.1.1"
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :promethee do
3
+ # # Task goes here
4
+ # end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: promethee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Dargelos
@@ -9,38 +9,178 @@ authors:
9
9
  - Pierre-André Boissinot
10
10
  - Antoine Prévost
11
11
  autorequire:
12
- bindir: exe
12
+ bindir: bin
13
13
  cert_chain: []
14
- date: 2017-10-30 00:00:00.000000000 Z
14
+ date: 2017-11-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: bundler
17
+ name: rails
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '1.15'
23
- type: :development
22
+ version: 5.1.3
23
+ type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '1.15'
29
+ version: 5.1.3
30
30
  - !ruby/object:Gem::Dependency
31
- name: rake
31
+ name: angularjs-rails
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - "~>"
35
35
  - !ruby/object:Gem::Version
36
- version: '10.0'
37
- type: :development
36
+ version: 1.6.2
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: 1.6.2
44
+ - !ruby/object:Gem::Dependency
45
+ name: angular-ui-tinymce-rails
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ type: :runtime
38
52
  prerelease: false
39
53
  version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ - !ruby/object:Gem::Dependency
59
+ name: bootstrap-sass
60
+ requirement: !ruby/object:Gem::Requirement
40
61
  requirements:
41
62
  - - "~>"
42
63
  - !ruby/object:Gem::Version
43
- version: '10.0'
64
+ version: 3.3.6
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: 3.3.6
72
+ - !ruby/object:Gem::Dependency
73
+ name: sass-rails
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '3.2'
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '3.2'
86
+ - !ruby/object:Gem::Dependency
87
+ name: jquery-rails
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ type: :runtime
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ - !ruby/object:Gem::Dependency
101
+ name: jquery-ui-rails
102
+ requirement: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ type: :runtime
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ - !ruby/object:Gem::Dependency
115
+ name: font-awesome-rails
116
+ requirement: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ type: :runtime
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ - !ruby/object:Gem::Dependency
129
+ name: tinymce-rails
130
+ requirement: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ type: :runtime
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: material_icons
144
+ requirement: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ type: :runtime
150
+ prerelease: false
151
+ version_requirements: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ - !ruby/object:Gem::Dependency
157
+ name: sqlite3
158
+ requirement: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ type: :development
164
+ prerelease: false
165
+ version_requirements: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ - !ruby/object:Gem::Dependency
171
+ name: byebug
172
+ requirement: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ type: :development
178
+ prerelease: false
179
+ version_requirements: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
44
184
  description:
45
185
  email:
46
186
  - contact@juliendargelos.com
@@ -51,19 +191,61 @@ executables: []
51
191
  extensions: []
52
192
  extra_rdoc_files: []
53
193
  files:
54
- - ".gitignore"
55
- - CODE_OF_CONDUCT.md
56
- - Gemfile
57
- - LICENSE
58
194
  - README.md
59
195
  - Rakefile
60
- - bin/console
61
- - bin/setup
196
+ - app/assets/images/icon-promethee.png
197
+ - app/assets/images/logo-promethee-horizontal.svg
198
+ - app/assets/images/logo-promethee-vertical.svg
199
+ - app/assets/javascripts/promethee.js
200
+ - app/assets/javascripts/promethee/controller.js
201
+ - app/assets/stylesheets/promethee-editor.sass
202
+ - app/assets/stylesheets/promethee-editor/_mixins.sass
203
+ - app/assets/stylesheets/promethee-editor/_variables.sass
204
+ - app/assets/stylesheets/promethee.sass
205
+ - app/views/promethee/_edit.html.erb
206
+ - app/views/promethee/_show.html.erb
207
+ - app/views/promethee/components/_column.html.erb
208
+ - app/views/promethee/components/_column_edit.html.erb
209
+ - app/views/promethee/components/_image.html.erb
210
+ - app/views/promethee/components/_image_edit.html.erb
211
+ - app/views/promethee/components/_index.html.erb
212
+ - app/views/promethee/components/_index_edit.html.erb
213
+ - app/views/promethee/components/_row.html.erb
214
+ - app/views/promethee/components/_row_edit.html.erb
215
+ - app/views/promethee/components/_show.html.erb
216
+ - app/views/promethee/components/_show_edit.html.erb
217
+ - app/views/promethee/components/_text.html.erb
218
+ - app/views/promethee/components/_text_edit.html.erb
219
+ - app/views/promethee/components/_video.html.erb
220
+ - app/views/promethee/components/_video_edit.html.erb
221
+ - app/views/promethee/partials/_toolbar_buttons.html.erb
62
222
  - lib/promethee.rb
63
- - lib/promethee/version.rb
64
- - promethee.gemspec
223
+ - lib/promethee/component.rb
224
+ - lib/promethee/component/attribute.rb
225
+ - lib/promethee/component/attribute/boolean.rb
226
+ - lib/promethee/component/attribute/float.rb
227
+ - lib/promethee/component/attribute/integer.rb
228
+ - lib/promethee/component/attribute/string.rb
229
+ - lib/promethee/component/attributes.rb
230
+ - lib/promethee/component/attributes/definer.rb
231
+ - lib/promethee/component/base.rb
232
+ - lib/promethee/component/collection.rb
233
+ - lib/promethee/component/column.rb
234
+ - lib/promethee/component/image.rb
235
+ - lib/promethee/component/row.rb
236
+ - lib/promethee/component/text.rb
237
+ - lib/promethee/component/video.rb
238
+ - lib/promethee/core_ext/form_builder.rb
239
+ - lib/promethee/core_ext/form_helper.rb
240
+ - lib/promethee/core_ext/tags.rb
241
+ - lib/promethee/grid.rb
242
+ - lib/promethee/rails/engine.rb
243
+ - lib/promethee/rails/helper.rb
244
+ - lib/promethee/rails/version.rb
245
+ - lib/tasks/promethee/promethee.rake
65
246
  homepage: https://github.com/lespoupeesrusses/promethee
66
- licenses: []
247
+ licenses:
248
+ - MIT
67
249
  metadata: {}
68
250
  post_install_message:
69
251
  rdoc_options: []
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at arnaud@semiodesign.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/