chili_pepper 0.1.3 → 0.1.4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 916f2b214cee4aee6005696c377e6d90bde762d8
|
4
|
+
data.tar.gz: d8fcec7a30d05a7b9b3d7d38316e540f038e1a7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86098858c6b909974bfdd8fa189978cbfb9e5f936d720cdd06d5d26156e5d928d08eb1355a6d7ec976761b40b6a39633e43ce4d7787ed5244329005e4e53b5f4
|
7
|
+
data.tar.gz: b8b1408e1bc4fe3089b3b7e7a6185c5057fb210acc3b96e496c0daae9e85abc63d7a5f1cf75619b94aa47e24d9249fb46a380a8c45950dac6698c30ec00fb163
|
@@ -9,12 +9,12 @@ module ChiliPepper
|
|
9
9
|
menu_type = params[:menu_type] || :food
|
10
10
|
if admin_signed_in?
|
11
11
|
@menu = Menu
|
12
|
-
.where(menu_type: Menu
|
12
|
+
.where(menu_type: Menu.menu_types[menu_type])
|
13
13
|
.first
|
14
14
|
redirect_to @menu.present? ? @menu : new_menu_path
|
15
15
|
else
|
16
16
|
@menu = Menu.published
|
17
|
-
.where(menu_type: Menu
|
17
|
+
.where(menu_type: Menu.menu_types[menu_type])
|
18
18
|
.first
|
19
19
|
redirect_to @menu.present? ? @menu : main_app.root_path
|
20
20
|
end
|
@@ -24,7 +24,7 @@ module ChiliPepper
|
|
24
24
|
@similar_menus = pick_similar_menus
|
25
25
|
|
26
26
|
if @menu.sections.any?
|
27
|
-
redirect_to menu_section_path(@menu, @menu.sections.first)
|
27
|
+
redirect_to menu_section_path(@menu, @menu.sections.position_sorted.first)
|
28
28
|
else
|
29
29
|
@section = ''
|
30
30
|
render layout: 'chili_pepper/menu'
|
@@ -6,8 +6,8 @@ module ChiliPepper
|
|
6
6
|
def show_section_header
|
7
7
|
if description? || heading?
|
8
8
|
header_content = ''
|
9
|
-
header_content += h.content_tag(:h1, h.markdown(heading), class: 'menu_section_heading') if heading?
|
10
9
|
header_content += h.image_tag(image.url(:medium), class: 'menu_section_image') if image?
|
10
|
+
header_content += h.content_tag(:h1, h.markdown(heading), class: 'menu_section_heading') if heading?
|
11
11
|
header_content += (h.content_tag :p, h.markdown(description), class: 'menu_section_description') if description?
|
12
12
|
h.content_tag :section, h.raw(header_content), class: 'section_header'
|
13
13
|
end
|
@@ -18,17 +18,21 @@
|
|
18
18
|
|
19
19
|
module ChiliPepper
|
20
20
|
class Section < ActiveRecord::Base
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
belongs_to :menu, class_name: 'ChiliPepper::Menu', touch: true
|
22
|
+
validates :menu, :name, presence: true
|
23
|
+
has_many :items, class_name: 'ChiliPepper::Item', dependent: :destroy
|
24
|
+
acts_as_list scope: :menu
|
25
25
|
extend FriendlyId
|
26
|
-
|
26
|
+
friendly_id :name, use: :slugged
|
27
27
|
has_attached_file :image,
|
28
28
|
styles: {
|
29
29
|
medium: ChiliPepper.section_medium_image,
|
30
30
|
thumb: '100x100>'
|
31
31
|
}
|
32
32
|
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
|
33
|
+
|
34
|
+
def self.position_sorted
|
35
|
+
order('position asc')
|
36
|
+
end
|
33
37
|
end
|
34
38
|
end
|
data/lib/chili_pepper/version.rb
CHANGED