diff --git a/.gitignore b/.gitignore index 03b6b8b..0a6875c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # Ignore bundler config. /.bundle +vendor/bundle/**/*.* # Ignore the default SQLite database. /db/*.sqlite3* diff --git a/app/helpers/suit_form_builder.rb b/app/helpers/suit_form_builder.rb index 2ef7e1e..1ea2617 100644 --- a/app/helpers/suit_form_builder.rb +++ b/app/helpers/suit_form_builder.rb @@ -10,9 +10,9 @@ def form_field(field, options = {}, &block) css_classes << 'FormField--required' if required css_classes << 'is-error' if field_errors.any? css_classes << options[:class_names] - # rubocop:disable HelperInstanceVariable - @template.content_tag :div, class: css_classes, &block - # rubocop:enable HelperInstanceVariable + # rubocop:disable Rails/HelperInstanceVariable + @template.tag.div(class: css_classes, &block) + # rubocop:enable Rails/HelperInstanceVariable end def label(method, text = nil, options = {}) @@ -41,9 +41,9 @@ def check_box(attribute, options = {}, checked_value = '1', unchecked_value = '0 end label(attribute, class: 'FormField-check FormField-check--checkbox') do super(attribute, options.reverse_merge(class: 'FormField-checkInput'), checked_value, unchecked_value) + - # rubocop:disable HelperInstanceVariable - @template.content_tag(:span, label_text, class: 'FormField-checkLabel') - # rubocop:enable HelperInstanceVariable + # rubocop:disable Rails/HelperInstanceVariable + @template.tag.span(label_text, class: 'FormField-checkLabel') + # rubocop:enable Rails/HelperInstanceVariable end end diff --git a/app/models/group_website.rb b/app/models/group_website.rb index fe7bfcd..6c9cf14 100644 --- a/app/models/group_website.rb +++ b/app/models/group_website.rb @@ -2,7 +2,7 @@ class GroupWebsite < ApplicationRecord belongs_to :group - validates :url, format: URI.regexp(%w[http https]) + validates :url, format: URI::DEFAULT_PARSER.make_regexp(%w[http https]) include Website delegate :name, prefix: true, to: :group end diff --git a/app/models/initiative_website.rb b/app/models/initiative_website.rb index abf5472..dc1b405 100644 --- a/app/models/initiative_website.rb +++ b/app/models/initiative_website.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class InitiativeWebsite < ApplicationRecord - validates :url, format: URI.regexp(%w[http https]) + validates :url, format: URI::DEFAULT_PARSER.make_regexp(%w[http https]) include Website belongs_to :initiative diff --git a/app/models/public_initiative.rb b/app/models/public_initiative.rb index 30ab8c0..0bb89df 100644 --- a/app/models/public_initiative.rb +++ b/app/models/public_initiative.rb @@ -3,7 +3,8 @@ # The publicly available data of an initiative class PublicInitiative include ActionView::Helpers::DateHelper - delegate :name, + delegate :id, + :name, :description_what, :description_how, :description_further_information, @@ -70,7 +71,7 @@ def websites end def last_updated - time_ago_in_words(timestamp) + ' ago' + "#{time_ago_in_words(timestamp)} ago" end def href @@ -81,6 +82,7 @@ def href # rubocop:disable Metrics/AbcSize def as_json(_options = {}) { + 'id': id, 'name': name, 'description_what': description_what, 'description_how': description_how, diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index d857803..9644b9e 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,4 +1,4 @@ -<%= javascript_packs_with_chunks_tag 'explore_tabs', 'data-turbolinks-track': 'reload' %> +<%= javascript_packs_with_chunks_tag 'home', 'data-turbolinks-track': 'reload' %>
We share community-based projects that work towards a Carbon Neutral Stroud District by 2030 and connect groups organising them.
Share knowledge. Enable Change
@@ -16,13 +16,9 @@ Or - @@ -75,7 +71,7 @@ <% @initiatives.each do |initiative| %> -