• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kleer-la / eventer / 9921234168

13 Jul 2024 04:09PM UTC coverage: 67.074% (-0.2%) from 67.275%
9921234168

push

github

jgabardini
rubocop -a  (2256 offenses corrected)

159 of 290 new or added lines in 54 files covered. (54.83%)

7 existing lines in 6 files now uncovered.

2249 of 3353 relevant lines covered (67.07%)

6.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

9.9
/app/admin/service_area.rb
1
# frozen_string_literal: true
2

3
ActiveAdmin.register ServiceArea do
1✔
4
  menu parent: 'Services Mgnt'
1✔
5

6
  permit_params :name, :slug, :icon, :primary_color, :secondary_color, :visible, :summary, :cta_message,
1✔
7
                :side_image, :slogan, :subtitle, :description, :target, :value_proposition, :ordering,
8
                :target_title, :seo_title, :seo_description
9
  filter :name
1✔
10

11
  controller do
1✔
12
    def find_resource
1✔
13
      scoped_collection.friendly.find(params[:id].strip)
×
14
    end
15
  end
16

17
  action_item :new_service, only: :edit do
1✔
18
    link_to 'New Service', new_admin_service_path(service_area_id: resource.id)
×
19
  end
20

21
  index do
1✔
22
    selectable_column
×
23
    id_column
×
24
    column :name
×
25
    column :subtitle
×
26
    column :slug
×
27
    column :ordering
×
28
    column :visible
×
29
    actions
×
30
  end
31

32
  form do |f|
1✔
33
    f.semantic_errors # Shows errors on :base
×
34
    f.inputs 'ServiceArea Details' do
×
35
      f.input :name
×
36
      f.input :slug, hint: 'The URL-friendly version of the name. (Empty to auto generete)'
×
37
      f.input :visible, as: :boolean
×
38
      f.input :icon, as: :url
×
39
      f.input :primary_color, as: :color, input_html: { style: 'width: 100%;' }
×
40
      f.input :secondary_color, as: :color, input_html: { style: 'width: 100%;' }
×
41
      f.input :summary, as: :rich_text_area
×
NEW
42
      f.input :cta_message, as: :rich_text_area,
×
43
                            hint: 'This text is shown just before the buttons. Example: <span style="font-style: normal;">Learn more of the <b>Your Service Name</b></span>'.html_safe
44
      f.input :side_image, as: :url
×
45
      f.input :slogan, as: :rich_text_area
×
46
      f.input :subtitle, as: :rich_text_area
×
47
      f.input :description, as: :rich_text_area
×
48
      f.input :target_title
×
49
      f.input :target, as: :rich_text_area
×
50
      f.input :value_proposition, as: :rich_text_area
×
51
      f.input :ordering
×
52
      f.input :seo_title
×
53
      f.input :seo_description
×
54
    end
55

NEW
56
    panel 'Existing Services' do
×
57
      ul do
×
58
        resource.services.each do |service|
×
59
          li do
×
60
            span link_to service.name, edit_admin_service_path(service)
×
61
            span service.subtitle
×
62
          end
63
        end
64
      end
65
    end
66

67
    f.actions         # Adds the 'Submit' and 'Cancel' buttons
×
68
  end
69

70
  show do
1✔
71
    def rich_row(field)
×
72
      row field do |service_area|
×
73
        service_area.send(field).to_s.html_safe if service_area.send(field).present?
×
74
      end
75
    end
76

77
    attributes_table do
×
78
      row :name
×
79
      row :slug
×
80
      row :visible
×
81
      row :icon do |service_area|
×
82
        if service_area.icon.present?
×
83
          image_tag service_area.icon, width: '50px', alt: 'Service Area Icon'
×
84
        else
85
          text_node 'No Icon defined'
×
86
        end
87
      end
88

89
      row :primary_color do |service_area|
×
NEW
90
        if service_area.primary_color.present?
×
NEW
91
          div style: "width: 30px; height: 30px; background-color: #{service_area.primary_color};"
×
92
        end
UNCOV
93
        text_node service_area.primary_color
×
94
      end
95

96
      row :secondary_color do |service_area|
×
NEW
97
        if service_area.secondary_color.present?
×
NEW
98
          div style: "width: 30px; height: 30px; background-color: #{service_area.secondary_color};"
×
99
        end
UNCOV
100
        text_node service_area.secondary_color
×
101
      end
102
      # This will safely render the rich text content, including formatting and attachments.
103
      rich_row :summary
×
104
      rich_row :cta_message
×
105
      row :side_image
×
106
      rich_row :slogan
×
107
      rich_row :subtitle
×
108
      rich_row :description
×
109
      row :target_title
×
110
      rich_row :target
×
111
      rich_row :value_proposition
×
112
      row :ordering
×
113
      row :seo_title
×
114
      row :seo_description
×
115
      if service_area.side_image.present?
×
116
        div 'Side Image '
×
117
        div do
×
118
          image_tag service_area.side_image
×
119
        end
120
      end
121
    end
NEW
122
    panel 'Services' do
×
123
      table_for service_area.services.order(:ordering) do
×
124
        column :name do |service|
×
125
          link_to service.name, admin_service_path(service)
×
126
        end
127
        column :subtitle
×
128
        column :ordering
×
129
      end
130
    end
131
    panel 'Testimonies' do
×
132
      table_for service_area.testimonies do
×
133
        column :first_name
×
134
        column :last_name
×
135
        column :profile_url do |testimony|
×
NEW
136
          link_to testimony.profile_url, testimony.profile_url, target: '_blank' if testimony.profile_url.present?
×
137
        end
138
        column :photo_url do |testimony|
×
139
          image_tag testimony.photo_url if testimony.photo_url.present?
×
140
        end
141
        column :testimony do |testimony|
×
142
          div testimony.testimony.body.to_s.html_safe
×
143
        end
144
        column :stared
×
145
        column '' do |testimony|
×
146
          link_to 'Edit', edit_admin_testimony_path(testimony), class: 'edit_link'
×
147
        end
148
      end
149
    end
150
  end
151
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc