spina-restaurantmenus 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad72a9166244ba063fc4ecb2e8316f6176397c89
4
- data.tar.gz: 3c81a78530863508d9e1359015475bcfd6269c23
3
+ metadata.gz: 1b11a3a439f732dba2d822f080b3ba170f93a168
4
+ data.tar.gz: 6ff0236e3ec88aefd427fcaea7e8b980425413a8
5
5
  SHA512:
6
- metadata.gz: 40ef82c75c88d3573ca065bad78718b8cc95c54772dcac3349e360327d84c0d68686c4bfcee89227354b57cfebd7b64f46d58ed22d4cb4862972a51fa6d3bd3a
7
- data.tar.gz: d97cc811a9d906d9c419d7dc198a16b359ab79f9dc95db3f4a8a5bdbb2e1c4f272ab4f0227269dbb9a20049924f5af0f341b72e95e48f749986c670e2a78d127
6
+ metadata.gz: ee78fca34ed78d22ee8d07ff4df190b752a759866871465a4b22a729143e1008af95153824dfed0597a2cb8951c83cd463ac93549841b84741e11119ef3c0053
7
+ data.tar.gz: bd5852064b4904cc1bc11012b5867070f284eb96f0781745d5b9635af2e559ed2b3d63ed446ffb03279679e72949935bf608dcbab2df0091d3aa150c9d4d694e
@@ -0,0 +1,3 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
3
+ //= require ./menus
@@ -0,0 +1,5 @@
1
+ $(document).on 'click', 'form .add_fields', (event) ->
2
+ time = new Date().getTime()
3
+ regexp = new RegExp($(this).data('id'), 'g')
4
+ $(this).before($(this).data('fields').replace(regexp, time))
5
+ event.preventDefault()
@@ -22,7 +22,7 @@
22
22
  input
23
23
  border: none
24
24
  box-shadow: none
25
- font-family: serif
25
+ font-family: Georgia, serif
26
26
  font-weight: 600
27
27
  padding: 5px 10px
28
28
 
@@ -33,14 +33,16 @@
33
33
  padding-top: 0
34
34
 
35
35
  .restaurant-dish-fields
36
+ align-items: center
37
+ justify-content: center
38
+ display: flex
36
39
  margin-bottom: 10px
37
40
 
38
- &:after
39
- clear: left
40
- content: " "
41
- display: block
41
+ .restaurant-dish-name
42
+ flex: 3
42
43
 
43
44
  .restaurant-dish-price
45
+ flex: 1
44
46
  text-align: right
45
47
 
46
48
  .remove_fields
@@ -0,0 +1,16 @@
1
+ module Spina
2
+ module Admin
3
+ module RestaurantMenusHelper
4
+ def link_to_add_fields(f, association, &block)
5
+ new_object = f.object.send(association).klass.new
6
+ id = new_object.object_id
7
+ fields = f.fields_for(association, new_object, child_index: id) do |builder|
8
+ render("spina/admin/#{ partable_partial_namespace(new_object) }/fields", f: builder)
9
+ end
10
+ link_to '#', class: "add_fields button button-link", data: {id: id, fields: fields.gsub("\n", "")} do
11
+ block.yield
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1 +1,3 @@
1
+ = javascript_include_tag 'restaurant_menus/application', data: {turbolinks_track: true}
2
+
1
3
  = stylesheet_link_tag 'restaurant_menus/restaurant_menus', data: {turbolinks_track: true}
@@ -1,9 +1,10 @@
1
- %fieldset.restaurant-dish-fields
2
- .restaurant-dish-name.column-nine
3
- = f.text_field :name, placeholder: 'Naam van gerecht'
4
- %small= f.text_field :description, placeholder: 'Beschrijving van gerecht'
1
+ %fieldset
2
+ .restaurant-dish-fields
3
+ .restaurant-dish-name.column-nine
4
+ = f.text_field :name, placeholder: 'Naam van gerecht'
5
+ %small= f.text_field :description, placeholder: 'Beschrijving van gerecht'
5
6
 
6
- .restaurant-dish-price.column-three
7
- = f.text_field :price, placeholder: 'Prijs'
8
- = f.hidden_field :_destroy
9
- = link_to 'verwijderen', '#', class: 'remove_fields button button-link button-mini icon-mini', data: {icon: 'l'}
7
+ .restaurant-dish-price.column-three
8
+ = f.text_field :price, placeholder: 'Prijs'
9
+ = f.hidden_field :_destroy
10
+ = link_to 'verwijderen', '#', class: 'remove_fields button button-link button-mini icon-mini', data: {icon: 'l'}
@@ -1,14 +1,15 @@
1
- %fieldset.restaurant-menu-form
2
- .restaurant-menu-name
3
- .pull-right
4
- = f.hidden_field :_destroy
5
- = link_to 'verwijder kaart', '#', class: 'remove_fields button button-link button-mini icon-mini', data: {icon: 'l'}
6
- .pull-left= f.text_field :name, placeholder: 'Menukaart'
1
+ %fieldset
2
+ .restaurant-menu-form
3
+ .restaurant-menu-name
4
+ .pull-right
5
+ = f.hidden_field :_destroy
6
+ = link_to 'verwijder kaart', '#', class: 'remove_fields button button-link button-mini icon-mini', data: {icon: 'l'}
7
+ .pull-left= f.text_field :name, placeholder: 'Menukaart'
7
8
 
8
- = f.fields_for :restaurant_dishes do |restaurant_dish_builder|
9
- = render 'spina/admin/restaurant_dishes/fields', f: restaurant_dish_builder
9
+ = f.fields_for :restaurant_dishes do |restaurant_dish_builder|
10
+ = render 'spina/admin/restaurant_dishes/fields', f: restaurant_dish_builder
10
11
 
11
- = link_to_add_fields f, :restaurant_dishes do
12
- %i{data: {icon: 't'}}
13
- gerecht toevoegen
14
-
12
+ = link_to_add_fields f, :restaurant_dishes do
13
+ %i{data: {icon: 't'}}
14
+ gerecht toevoegen
15
+
@@ -3,11 +3,15 @@ module Spina
3
3
  class Engine < ::Rails::Engine
4
4
  isolate_namespace Spina
5
5
 
6
- initializer "register plugin" do
6
+ initializer "spina_restaurantmenus.register" do
7
7
  Spina::Plugin.register do |plugin|
8
8
  plugin.name = 'restaurant_menus'
9
9
  plugin.namespace = 'restaurant_menus'
10
10
  end
11
+
12
+ ActiveSupport.on_load :action_view do
13
+ include Spina::Admin::RestaurantMenusHelper
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -1,5 +1,5 @@
1
1
  module Spina
2
2
  module Restaurantmenus
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spina-restaurantmenus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bram Jetten
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-11 00:00:00.000000000 Z
11
+ date: 2017-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spina
@@ -34,7 +34,10 @@ files:
34
34
  - MIT-LICENSE
35
35
  - README.rdoc
36
36
  - Rakefile
37
+ - app/assets/javascripts/restaurant_menus/application.js
38
+ - app/assets/javascripts/restaurant_menus/menus.coffee
37
39
  - app/assets/stylesheets/restaurant_menus/restaurant_menus.css.sass
40
+ - app/helpers/spina/admin/restaurant_menus_helper.rb
38
41
  - app/models/spina/restaurant_dish.rb
39
42
  - app/models/spina/restaurant_menu.rb
40
43
  - app/models/spina/restaurant_menu_collection.rb