chili_pepper 0.1.3 → 0.1.4

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: 61039b400230929e6ab13346dea4b736853c4096
4
- data.tar.gz: aaa3d2f22996b4cb4461678bc904f39bffd9de5e
3
+ metadata.gz: 916f2b214cee4aee6005696c377e6d90bde762d8
4
+ data.tar.gz: d8fcec7a30d05a7b9b3d7d38316e540f038e1a7b
5
5
  SHA512:
6
- metadata.gz: 6da604f13d226608e8575d905d6161f7763457315b412042c0a1c65ede2eb16de702f476a7341898cec4a1039795f88dc6b7028c2ca74b77a419492b8378fdfd
7
- data.tar.gz: 048734f2d4ff32d7b692f082de2027825ce558cfeae9d60412799600238a0836a7a1a03cf42d1e6685fd45f98142cf037f6c9022a7064bf39c33faad582c4423
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::menu_types[menu_type])
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::menu_types[menu_type])
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
- 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
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
- friendly_id :name, use: :slugged
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
@@ -1,3 +1,3 @@
1
1
  module ChiliPepper
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chili_pepper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loic Seigland