bulma_form_rails 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.idea/.gitignore +8 -0
- data/.idea/bulma_form_rails.iml +82 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.rbenv-gemsets +3 -0
- data/.ruby-version +1 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +203 -0
- data/LICENSE +29 -0
- data/README.md +163 -0
- data/Rakefile +11 -0
- data/doc/BulmaFormRails/Helpers.html +698 -0
- data/doc/BulmaFormRails.html +93 -0
- data/doc/created.rid +2 -0
- data/doc/css/fonts.css +167 -0
- data/doc/css/rdoc.css +639 -0
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/moderngeosystems_logo.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +82 -0
- data/doc/js/darkfish.js +84 -0
- data/doc/js/navigation.js +105 -0
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +110 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +229 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +125 -0
- data/lib/bulma_form_rails/field_helpers.rb +239 -0
- data/lib/bulma_form_rails/form_page_helpers.rb +36 -0
- data/lib/bulma_form_rails/header_and_footer_helpers.rb +36 -0
- data/lib/bulma_form_rails/javascript/controllers/child_objects_controller.js +66 -0
- data/lib/bulma_form_rails/message_box_helpers.rb +25 -0
- data/lib/bulma_form_rails/railtie.rb +62 -0
- data/lib/bulma_form_rails/subform_helpers.rb +33 -0
- data/lib/bulma_form_rails/version.rb +3 -0
- data/lib/bulma_form_rails.rb +3 -0
- data/lib/generators/bulma_form_rails/pagy_config_generator.rb +15 -0
- data/lib/generators/bulma_form_rails/views_generator.rb +19 -0
- data/lib/install/bulma_form_rails.rb +13 -0
- data/lib/tasks/bulma_form_rails_tasks.rake +30 -0
- data/lib/templates/app/views/_form.html.erb +0 -0
- data/lib/templates/app/views/bulma_form_rails/_child.html.erb +61 -0
- data/lib/templates/app/views/bulma_form_rails/_children.html.erb +61 -0
- data/lib/templates/app/views/bulma_form_rails/_datetime_select.html.erb +10 -0
- data/lib/templates/app/views/bulma_form_rails/_edit_form_page.html.erb +15 -0
- data/lib/templates/app/views/bulma_form_rails/_field.html.erb +10 -0
- data/lib/templates/app/views/bulma_form_rails/_form_footer.html.erb +17 -0
- data/lib/templates/app/views/bulma_form_rails/_index_header.html.erb +16 -0
- data/lib/templates/app/views/bulma_form_rails/_message_box.html.erb +35 -0
- data/lib/templates/app/views/bulma_form_rails/_new_form_page.html.erb +15 -0
- data/lib/templates/app/views/bulma_form_rails/_radio_group.html.erb +6 -0
- data/lib/templates/app/views/bulma_form_rails/_select.html.erb +7 -0
- data/lib/templates/app/views/bulma_form_rails/_time_select.html.erb +10 -0
- data/lib/templates/app/views/bulma_form_rails/_validation_box.html.erb +15 -0
- data/lib/templates/app/views/bulma_form_rails/_value.html.erb +6 -0
- data/lib/templates/config/initializers/pagy.rb +211 -0
- data/package.json +45 -0
- data/sig/bulma_form_helper.rbs +68 -0
- data/yarn.lock +53 -0
- metadata +291 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
say "Install Bulma Form Rails"
|
2
|
+
say "Bulma Form Rails requires Stimulus@3.0.1+", :yellow
|
3
|
+
|
4
|
+
# Register Stimulus controller
|
5
|
+
copy_file File.join(Gem.loaded_specs['bulma_form_rails'].full_gem_path, 'lib', 'bulma_form_rails', 'javascript', 'controllers', 'child_objects_controller.js'), File.join('app', 'javascript', 'controllers', 'child_objects_controller.js')
|
6
|
+
append_to_file File.join('app', 'javascript', 'controllers', 'index.js'), %(\nimport ChildObjectsController from "./child_objects_controller.js"\n)
|
7
|
+
append_to_file File.join('app', 'javascript', 'controllers', 'index.js'), %(application.register("child-objects", ChildObjectsController)\n)
|
8
|
+
|
9
|
+
# Configure RBS
|
10
|
+
copy_file File.join(Gem.loaded_specs['bulma_form_rails'].full_gem_path, 'sig', 'bulma_form_helper.rbs'), File.join('sig', 'bulma_form_helper.rbs')
|
11
|
+
|
12
|
+
# Install JavaScript dependencies
|
13
|
+
system('yarn add @rails/request.js bulma-popover bulmahead')
|
@@ -0,0 +1,30 @@
|
|
1
|
+
def run_template_path(path)
|
2
|
+
system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../install/#{path}.rb", __dir__)}"
|
3
|
+
end
|
4
|
+
|
5
|
+
def stimulus_installed?
|
6
|
+
(Rails.root.join("app/javascript/controllers/index.js")).exist?
|
7
|
+
end
|
8
|
+
|
9
|
+
def switch_on_stimulus
|
10
|
+
Rake::Task["webpacker:install:stimulus"].invoke
|
11
|
+
end
|
12
|
+
|
13
|
+
def switch_on_turbo
|
14
|
+
Rake::Task["turbo:install"].invoke
|
15
|
+
end
|
16
|
+
|
17
|
+
namespace :bulma_form_rails do
|
18
|
+
desc "Install bulma_form_rails packages"
|
19
|
+
task install: %i[stimulus turbo] do
|
20
|
+
run_template_path "bulma_form_rails"
|
21
|
+
end
|
22
|
+
|
23
|
+
task :stimulus do
|
24
|
+
switch_on_stimulus unless stimulus_installed?
|
25
|
+
end
|
26
|
+
|
27
|
+
task :turbo do
|
28
|
+
switch_on_turbo
|
29
|
+
end
|
30
|
+
end
|
File without changes
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<% totals ||= nil %>
|
2
|
+
<% container ||= '' %>
|
3
|
+
<% container_class = container.gsub(/\[\d+\]/, '').gsub(/\[|\]/, '-') %>
|
4
|
+
<% form_id ||= '' %>
|
5
|
+
<% stimulus_controller_name = name.pluralize.dasherize %>
|
6
|
+
<% attributes = lookup_attributes(attributes_key) if attributes_key %>
|
7
|
+
<%
|
8
|
+
begin
|
9
|
+
hidden_fields = "#{name.classify}::HIDDEN_FIELDS".constantize
|
10
|
+
rescue NameError, LoadError
|
11
|
+
hidden_fields = []
|
12
|
+
end
|
13
|
+
%>
|
14
|
+
|
15
|
+
<tr class="subform-record-row" id="<%= "#{name.pluralize}#{container}[#{child_counter}]" %>" data-child-objects-target="child-objects.row">
|
16
|
+
<% attributes.each do |attribute| %>
|
17
|
+
<td class="subform-field-cell">
|
18
|
+
<% attribute_value = child.send(attribute) %>
|
19
|
+
<% if hidden_fields.include? attribute.to_sym %>
|
20
|
+
<%= hidden_field_tag "#{name.pluralize}#{container}[#{child_counter}][#{attribute}]", attribute_value, class: "#{name.pluralize}#{container_class}_#{attribute}" %>
|
21
|
+
<% else %>
|
22
|
+
<% if eval %Q|!child.respond_to?("#{attribute}=")| %>
|
23
|
+
<% if eval "#{name.classify}::WRITE_ONCE_ATTRIBUTES.detect {|woa| woa == :#{attribute}}" %>
|
24
|
+
<% if child.respond_to?(:format_for_value) -%>
|
25
|
+
<%= hidden_field_tag "#{name.pluralize}#{container}[#{child_counter}][#{attribute}]", child.format_for_value(attribute, attribute_value), class: "#{name.pluralize}#{container_class}_#{attribute}" %>
|
26
|
+
<% else -%>
|
27
|
+
<%= hidden_field_tag "#{name.pluralize}#{container}[#{child_counter}][#{attribute}]", (attribute_value.respond_to?(:to_html) ? attribute_value.to_html : attribute_value), class: "#{name.pluralize}#{container_class}_#{attribute}" %>
|
28
|
+
<% end -%>
|
29
|
+
<% end %>
|
30
|
+
<% if child.respond_to?(:format_for_display) -%>
|
31
|
+
<span id='<%="#{name.pluralize}#{container}_display[#{child_counter}][#{attribute}]"%>'><%= h child.format_for_display(attribute, attribute_value) %></span>
|
32
|
+
<% else -%>
|
33
|
+
<span id='<%="#{name.pluralize}#{container}_display[#{child_counter}][#{attribute}]"%>'><%= h(attribute_value.respond_to?(:to_html) ? attribute_value.to_html : attribute_value) %></span>
|
34
|
+
<% end -%>
|
35
|
+
<% else %>
|
36
|
+
<% if attribute[-4..-1] == 'time' %>
|
37
|
+
<%= select_time(attribute_value, prefix: "#{name.pluralize}#{container}[#{child_counter}][#{attribute}]", minute_step: 5, ampm: true, include_blank: true, class: 'select is-small') %>
|
38
|
+
<% elsif attribute[-3..-1] == '_id' %>
|
39
|
+
<%= select_tag "#{name.pluralize}#{container}[#{child_counter}][#{attribute}]", options_for_select(id_select_options(attribute).unshift(["Select One", ""]), attribute_value.to_i), class: 'select is-small' %>
|
40
|
+
<% else %>
|
41
|
+
<%= text_field_tag "#{name.pluralize}#{container}[#{child_counter}][#{attribute}]", (attribute_value.respond_to?(:to_html) ? attribute_value.to_html : attribute_value), size: (attribute == "covers" ? 2 : 10), class: "#{name.pluralize}#{container_class}_#{attribute} input is-small", data: {"#{stimulus_controller_name}-container": container, "#{stimulus_controller_name}-container-class": container_class, "#{stimulus_controller_name}-form-id": form_id, action: "change->#{stimulus_controller_name}#updateTotals"} %>
|
42
|
+
<% end %>
|
43
|
+
<% end %>
|
44
|
+
<% end %>
|
45
|
+
<% field_index = attributes.index(attribute) %>
|
46
|
+
<% totals[field_index] += attribute_value.to_f if (totals && field_index && totals[field_index] && attribute_value.respond_to?(:to_f)) %>
|
47
|
+
</td>
|
48
|
+
<% end %>
|
49
|
+
<% unless system_controlled %>
|
50
|
+
<td class="subform-record-control-cell">
|
51
|
+
<%= button_tag "delete", type: :button, class: 'button is-small is-danger', data: {action: 'click->child-objects#deleteRow'} %>
|
52
|
+
</td>
|
53
|
+
<% end %>
|
54
|
+
</tr>
|
55
|
+
<% if last && !system_controlled %>
|
56
|
+
<tr class="subform-control-row" id="<%= name %>-adder-bar">
|
57
|
+
<td class="subform-control-cell" colspan="<%= attributes.size + 1 %>">
|
58
|
+
<%= button_tag "add another", type: :button, class: 'button is-small is-primary', data: {action: 'click->child-objects#addRow'} %>
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
<% end %>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<% title ||= name %>
|
2
|
+
<% container ||= '' %>
|
3
|
+
<% system_controlled = false if system_controlled.nil? %>
|
4
|
+
<% form_id ||= nil %>
|
5
|
+
<% attributes_key ||= nil %>
|
6
|
+
<% attributes = lookup_attributes(attributes_key) unless attributes_key.blank? %>
|
7
|
+
<% totals = Array.new(attributes.size) %>
|
8
|
+
<% total_columns ||= [] %>
|
9
|
+
<% total_columns.each {|total_column| totals[total_column - 1] = 0.00} %>
|
10
|
+
<%
|
11
|
+
begin
|
12
|
+
hidden_fields = "#{name.classify}::HIDDEN_FIELDS".constantize
|
13
|
+
rescue NameError, LoadError
|
14
|
+
hidden_fields = []
|
15
|
+
end
|
16
|
+
%>
|
17
|
+
|
18
|
+
<div class="field is-horizontal">
|
19
|
+
<div class="field-label is-normal">
|
20
|
+
<% if container.empty? %>
|
21
|
+
<label class="label"><%= title.tr("_", " ").pluralize.split.each(&:capitalize!).join ' ' %></label>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
<div class="field-body">
|
25
|
+
<div class="field">
|
26
|
+
<div class="control">
|
27
|
+
<table class="table is-striped is-hoverable is-narrow">
|
28
|
+
<tbody id="<%= name %>-table" data-controller="<%= system_controlled ? name.pluralize.dasherize : 'child-objects' %>" data-child-objects-target="table" data-child-objects-url-value="<%= url %>" data-child-objects-name-value="<%= name %>" data-child-objects-attributes-key-value="<%= attributes_key %>">
|
29
|
+
<tr>
|
30
|
+
<% attributes.each do |attribute| %>
|
31
|
+
<th class="has-background-primary has-text-white">
|
32
|
+
<% if not hidden_fields.include? attribute.to_sym %>
|
33
|
+
<% if attribute[-3..-1] == "_id" -%>
|
34
|
+
<%= attribute[0..-3].tr("_", " ").capitalize_words %>
|
35
|
+
<% else -%>
|
36
|
+
<%= attribute.tr("_", " ").split.each(&:capitalize!).join ' ' %>
|
37
|
+
<% end -%>
|
38
|
+
<% end -%>
|
39
|
+
</th>
|
40
|
+
<% end %>
|
41
|
+
<th class="has-background-primary has-text-white"></th>
|
42
|
+
</tr>
|
43
|
+
<%= render partial: 'bulma_form_rails/child', collection: children, locals: { name: name, container: container, attributes: attributes, last: false, system_controlled: system_controlled, totals: totals, attributes_key: attributes_key, form_id: form_id } %>
|
44
|
+
<% unless total_columns.empty? %>
|
45
|
+
<tr>
|
46
|
+
<% totals.each do |total| %>
|
47
|
+
<td>
|
48
|
+
<strong><%= total.nil? ? '' : raw("<span id='#{name.pluralize}#{container}_total' data-#{name.pluralize.dasherize}-target='#{name.pluralize.dasherize}#{container}_total'>#{ASAP::Money.new(:amount => total).to_html}</span>") %></strong>
|
49
|
+
</td>
|
50
|
+
<% end %>
|
51
|
+
</tr>
|
52
|
+
<% end %>
|
53
|
+
<% unless system_controlled %>
|
54
|
+
<%= render partial: 'bulma_form_rails/child', locals: { child: eval("#{name.capitalize.gsub(/_(.)/) {|s| $1.capitalize}}.new"), container: container, child_counter: children.size, name: name, attributes: attributes, attributes_key: attributes_key, form_id: form_id, last: true, system_controlled: false } %>
|
55
|
+
<% end %>
|
56
|
+
</tbody>
|
57
|
+
</table>
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
</div>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<div class="field is-narrow">
|
2
|
+
<div class="control">
|
3
|
+
<div class="<%= options[:class] %>">
|
4
|
+
<% time_select_tags = capture do %>
|
5
|
+
<%= bulma_form_or_object_component form_or_object, :datetime_select, options, html_options %>
|
6
|
+
<% end %>
|
7
|
+
<%= render inline: bulma_datetime_select_tags(time_select_tags) %>
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<section class="section">
|
2
|
+
<div class="level">
|
3
|
+
<div class="level-left">
|
4
|
+
<div class="level-item">
|
5
|
+
<h1 class="title">Edit <%= name.to_s.humanize %></h1>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
<div class="level-right">
|
9
|
+
<div class="level-item">
|
10
|
+
<%= link_to 'Never Mind', models_path, class: 'button is-warning' %>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
<%= render 'form', name => model, url: model_path %>
|
15
|
+
</section>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% additional_field_label_classes ||= '' %>
|
2
|
+
<div class="field is-horizontal<%= options[:outer_class] ? " #{options[:outer_class]}" : '' %>" <%= options[:outer_id] ? 'id=' + options[:outer_id] : '' %> <%= options[:style] ? raw('style="' + options[:style] + '"') : '' %>>
|
3
|
+
<div class="field-label <%= additional_field_label_classes %>">
|
4
|
+
<%= bulma_form_or_object_component form_or_object, :label, *label_parameters %>
|
5
|
+
</div>
|
6
|
+
<div class="field-body">
|
7
|
+
<% options.delete(:style); options.delete(:outer_id); options.delete(:outer_class) %>
|
8
|
+
<%= yield(@form_or_object) %>
|
9
|
+
</div>
|
10
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div class="level">
|
2
|
+
<div class="level-left">
|
3
|
+
<% unless options[:exclude_submit_button] %>
|
4
|
+
<div class="level-item">
|
5
|
+
<%= form.submit class: 'button is-primary', id: 'primary_submit_button' %>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
8
|
+
<div class="level-item">
|
9
|
+
<%= link_to 'Never Mind', url, class: 'button is-warning' %>
|
10
|
+
</div>
|
11
|
+
<% if block_given? %>
|
12
|
+
<div class="level-item">
|
13
|
+
<%= yield %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
17
|
+
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= bulma_message_box %>
|
2
|
+
|
3
|
+
<div class="level">
|
4
|
+
<div class="level-left">
|
5
|
+
<div class="level-item">
|
6
|
+
<h1 class="title"><%= name.to_s.pluralize.humanize %></h1>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
<div class="level-right">
|
10
|
+
<div class="level-item">
|
11
|
+
<div class="buttons">
|
12
|
+
<%= link_to "New", models_path, class: 'button is-primary' %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<% if !flash[:notice].blank? %>
|
2
|
+
<div class="message is-primary">
|
3
|
+
<div class="message-header">
|
4
|
+
<p>Notice</p>
|
5
|
+
</div>
|
6
|
+
<div class="message-body">
|
7
|
+
<p><%= flash[:notice] %></p>
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
<% flash.discard(:notice) %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<% if !flash[:warning].blank? %>
|
14
|
+
<div class="message is-warning">
|
15
|
+
<div class="message-header">
|
16
|
+
<p>Warning</p>
|
17
|
+
</div>
|
18
|
+
<div class="message-body">
|
19
|
+
<p><%= flash[:warning] %></p>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<% flash.discard(:warning) %>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<% if !flash[:error].blank? %>
|
26
|
+
<div class="message is-danger">
|
27
|
+
<div class="message-header">
|
28
|
+
<p>Error</p>
|
29
|
+
</div>
|
30
|
+
<div class="message-body">
|
31
|
+
<p><%= flash[:error] %></p>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
<% flash.discard(:error) %>
|
35
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<section class="section">
|
2
|
+
<div class="level">
|
3
|
+
<div class="level-left">
|
4
|
+
<div class="level-item">
|
5
|
+
<h1 class="title">Create new <%= name.to_s.humanize %></h1>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
<div class="level-right">
|
9
|
+
<div class="level-item">
|
10
|
+
<%= link_to 'Never Mind', models_path, class: 'button is-warning' %>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
<%= render 'form', name => model, url: models_path %>
|
15
|
+
</section>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<div class="field is-narrow">
|
2
|
+
<% choices.each do |choice| %>
|
3
|
+
<%= bulma_form_or_object_component form_or_object, :radio_button, field_name, choice[0], {class: 'radio'}.merge(choice[2] ? choice[2] : {}).merge(options) %>
|
4
|
+
<%= bulma_form_or_object_component form_or_object, :label, choice[1], options %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<div class="field is-narrow">
|
2
|
+
<div class="control">
|
3
|
+
<div class="<%= options[:class] %>">
|
4
|
+
<% time_select_tags = capture do %>
|
5
|
+
<%= bulma_form_or_object_component form_or_object, :time_select, field_name, options, html_options %>
|
6
|
+
<% end %>
|
7
|
+
<%= render inline: bulma_datetime_select_tags(time_select_tags) %>
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if model %>
|
2
|
+
<%= bulma_message_box %>
|
3
|
+
<% if !model.errors.empty? || !flash[:error].blank? %>
|
4
|
+
<div class="message is-danger">
|
5
|
+
<div class="message-header">
|
6
|
+
<p>Invalid Input</p>
|
7
|
+
</div>
|
8
|
+
<div class="message-body">
|
9
|
+
<% model.errors.full_messages.each do |message| %>
|
10
|
+
<p><%= message %></p>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
@@ -0,0 +1,211 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Pagy initializer file (5.1.3)
|
4
|
+
# Customize only what you really need and notice that Pagy works also without any of the following lines.
|
5
|
+
# Should you just cherry pick part of this file, please maintain the require-order of the extras
|
6
|
+
|
7
|
+
|
8
|
+
# Pagy Variables
|
9
|
+
# See https://ddnexus.github.io/pagy/api/pagy#variables
|
10
|
+
# All the Pagy::DEFAULT are set for all the Pagy instances but can be overridden
|
11
|
+
# per instance by just passing them to Pagy.new or the #pagy controller method
|
12
|
+
|
13
|
+
|
14
|
+
# Instance variables
|
15
|
+
# See https://ddnexus.github.io/pagy/api/pagy#instance-variables
|
16
|
+
# Pagy::DEFAULT[:page] = 1 # default
|
17
|
+
# Pagy::DEFAULT[:items] = 20 # default
|
18
|
+
# Pagy::DEFAULT[:outset] = 0 # default
|
19
|
+
|
20
|
+
|
21
|
+
# Other Variables
|
22
|
+
# See https://ddnexus.github.io/pagy/api/pagy#other-variables
|
23
|
+
# Pagy::DEFAULT[:size] = [1,4,4,1] # default
|
24
|
+
# Pagy::DEFAULT[:page_param] = :page # default
|
25
|
+
# Pagy::DEFAULT[:params] = {} # default
|
26
|
+
# Pagy::DEFAULT[:fragment] = '#fragment' # example
|
27
|
+
# Pagy::DEFAULT[:link_extra] = 'data-remote="true"' # example
|
28
|
+
# Pagy::DEFAULT[:i18n_key] = 'pagy.item_name' # default
|
29
|
+
# Pagy::DEFAULT[:cycle] = true # example
|
30
|
+
|
31
|
+
|
32
|
+
# Extras
|
33
|
+
# See https://ddnexus.github.io/pagy/extras
|
34
|
+
|
35
|
+
|
36
|
+
# Backend Extras
|
37
|
+
|
38
|
+
# Array extra: Paginate arrays efficiently, avoiding expensive array-wrapping and without overriding
|
39
|
+
# See https://ddnexus.github.io/pagy/extras/array
|
40
|
+
# require 'pagy/extras/array'
|
41
|
+
|
42
|
+
# Countless extra: Paginate without any count, saving one query per rendering
|
43
|
+
# See https://ddnexus.github.io/pagy/extras/countless
|
44
|
+
# require 'pagy/extras/countless'
|
45
|
+
# Pagy::DEFAULT[:countless_minimal] = false # default (eager loading)
|
46
|
+
|
47
|
+
# Elasticsearch Rails extra: Paginate `ElasticsearchRails::Results` objects
|
48
|
+
# See https://ddnexus.github.io/pagy/extras/elasticsearch_rails
|
49
|
+
# default :pagy_search method: change only if you use also
|
50
|
+
# the searchkick or meilisearch extra that defines the same
|
51
|
+
# Pagy::DEFAULT[:elasticsearch_rails_search_method] = :pagy_search
|
52
|
+
# require 'pagy/extras/elasticsearch_rails'
|
53
|
+
|
54
|
+
# Headers extra: http response headers (and other helpers) useful for API pagination
|
55
|
+
# See http://ddnexus.github.io/pagy/extras/headers
|
56
|
+
# require 'pagy/extras/headers'
|
57
|
+
# Pagy::DEFAULT[:headers] = { page: 'Current-Page',
|
58
|
+
# items: 'Page-Items',
|
59
|
+
# count: 'Total-Count',
|
60
|
+
# pages: 'Total-Pages' } # default
|
61
|
+
|
62
|
+
# Meilisearch extra: Paginate `Meilisearch` result objects
|
63
|
+
# See https://ddnexus.github.io/pagy/extras/meilisearch
|
64
|
+
# default :pagy_search method: change only if you use also
|
65
|
+
# the elasticsearch_rails or searchkick extra that define the same method
|
66
|
+
# Pagy::DEFAULT[:meilisearch_search_method] = :pagy_search
|
67
|
+
# require 'pagy/extras/meilisearch'
|
68
|
+
|
69
|
+
# Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc.
|
70
|
+
# See https://ddnexus.github.io/pagy/extras/metadata
|
71
|
+
# you must require the shared internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
|
72
|
+
# require 'pagy/extras/shared'
|
73
|
+
# require 'pagy/extras/metadata'
|
74
|
+
# For performance reason, you should explicitly set ONLY the metadata you use in the frontend
|
75
|
+
# Pagy::DEFAULT[:metadata] = [:scaffold_url, :count, :page, :prev, :next, :last] # example
|
76
|
+
|
77
|
+
# Searchkick extra: Paginate `Searchkick::Results` objects
|
78
|
+
# See https://ddnexus.github.io/pagy/extras/searchkick
|
79
|
+
# default :pagy_search method: change only if you use also
|
80
|
+
# the elasticsearch_rails or meilisearch extra that defines the same
|
81
|
+
# DEFAULT[:searchkick_search_method] = :pagy_search
|
82
|
+
# require 'pagy/extras/searchkick'
|
83
|
+
# uncomment if you are going to use Searchkick.pagy_search
|
84
|
+
# Searchkick.extend Pagy::Searchkick
|
85
|
+
|
86
|
+
|
87
|
+
# Frontend Extras
|
88
|
+
|
89
|
+
# Bootstrap extra: Add nav, nav_js and combo_nav_js helpers and templates for Bootstrap pagination
|
90
|
+
# See https://ddnexus.github.io/pagy/extras/bootstrap
|
91
|
+
# require 'pagy/extras/bootstrap'
|
92
|
+
|
93
|
+
# Bulma extra: Add nav, nav_js and combo_nav_js helpers and templates for Bulma pagination
|
94
|
+
# See https://ddnexus.github.io/pagy/extras/bulma
|
95
|
+
require 'pagy/extras/bulma'
|
96
|
+
|
97
|
+
# Foundation extra: Add nav, nav_js and combo_nav_js helpers and templates for Foundation pagination
|
98
|
+
# See https://ddnexus.github.io/pagy/extras/foundation
|
99
|
+
# require 'pagy/extras/foundation'
|
100
|
+
|
101
|
+
# Materialize extra: Add nav, nav_js and combo_nav_js helpers for Materialize pagination
|
102
|
+
# See https://ddnexus.github.io/pagy/extras/materialize
|
103
|
+
# require 'pagy/extras/materialize'
|
104
|
+
|
105
|
+
# Navs extra: Add nav_js and combo_nav_js javascript helpers
|
106
|
+
# Notice: the other frontend extras add their own framework-styled versions,
|
107
|
+
# so require this extra only if you need the unstyled version
|
108
|
+
# See https://ddnexus.github.io/pagy/extras/navs
|
109
|
+
# require 'pagy/extras/navs'
|
110
|
+
|
111
|
+
# Semantic extra: Add nav, nav_js and combo_nav_js helpers for Semantic UI pagination
|
112
|
+
# See https://ddnexus.github.io/pagy/extras/semantic
|
113
|
+
# require 'pagy/extras/semantic'
|
114
|
+
|
115
|
+
# UIkit extra: Add nav helper and templates for UIkit pagination
|
116
|
+
# See https://ddnexus.github.io/pagy/extras/uikit
|
117
|
+
# require 'pagy/extras/uikit'
|
118
|
+
|
119
|
+
# Multi size var used by the *_nav_js helpers
|
120
|
+
# See https://ddnexus.github.io/pagy/extras/navs#steps
|
121
|
+
# Pagy::DEFAULT[:steps] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] } # example
|
122
|
+
|
123
|
+
|
124
|
+
# Feature Extras
|
125
|
+
|
126
|
+
# Gearbox extra: Automatically change the number of items per page depending on the page number
|
127
|
+
# See https://ddnexus.github.io/pagy/extras/gearbox
|
128
|
+
# require 'pagy/extras/gearbox'
|
129
|
+
# set to false only if you want to make :gearbox_extra an opt-in variable
|
130
|
+
# Pagy::DEFAULT[:gearbox_extra] = false # default true
|
131
|
+
# Pagy::DEFAULT[:gearbox_items] = [15, 30, 60, 100] # default
|
132
|
+
|
133
|
+
# Items extra: Allow the client to request a custom number of items per page with an optional selector UI
|
134
|
+
# See https://ddnexus.github.io/pagy/extras/items
|
135
|
+
# require 'pagy/extras/items'
|
136
|
+
# set to false only if you want to make :items_extra an opt-in variable
|
137
|
+
# Pagy::DEFAULT[:items_extra] = false # default true
|
138
|
+
# Pagy::DEFAULT[:items_param] = :items # default
|
139
|
+
# Pagy::DEFAULT[:max_items] = 100 # default
|
140
|
+
|
141
|
+
# Overflow extra: Allow for easy handling of overflowing pages
|
142
|
+
# See https://ddnexus.github.io/pagy/extras/overflow
|
143
|
+
# require 'pagy/extras/overflow'
|
144
|
+
# Pagy::DEFAULT[:overflow] = :empty_page # default (other options: :last_page and :exception)
|
145
|
+
|
146
|
+
# Support extra: Extra support for features like: incremental, infinite, auto-scroll pagination
|
147
|
+
# See https://ddnexus.github.io/pagy/extras/support
|
148
|
+
# require 'pagy/extras/support'
|
149
|
+
|
150
|
+
# Trim extra: Remove the page=1 param from links
|
151
|
+
# See https://ddnexus.github.io/pagy/extras/trim
|
152
|
+
# require 'pagy/extras/trim'
|
153
|
+
# set to false only if you want to make :trim_extra an opt-in variable
|
154
|
+
# Pagy::DEFAULT[:trim_extra] = false # default true
|
155
|
+
|
156
|
+
# Standalone extra: Use pagy in non Rack environment/gem
|
157
|
+
# See https://ddnexus.github.io/pagy/extras/standalone
|
158
|
+
# require 'pagy/extras/standalone'
|
159
|
+
# Pagy::DEFAULT[:url] = 'http://www.example.com/subdir' # optional default
|
160
|
+
|
161
|
+
|
162
|
+
# Rails
|
163
|
+
|
164
|
+
# Rails: extras assets path required by the helpers that use javascript
|
165
|
+
# (pagy*_nav_js, pagy*_combo_nav_js, and pagy_items_selector_js)
|
166
|
+
# See https://ddnexus.github.io/pagy/extras#javascript
|
167
|
+
# Rails.application.config.assets.paths << Pagy.root.join('javascripts')
|
168
|
+
|
169
|
+
|
170
|
+
# I18n
|
171
|
+
|
172
|
+
# Pagy internal I18n: ~18x faster using ~10x less memory than the i18n gem
|
173
|
+
# See https://ddnexus.github.io/pagy/api/frontend#i18n
|
174
|
+
# Notice: No need to configure anything in this section if your app uses only "en"
|
175
|
+
# or if you use the i18n extra below
|
176
|
+
#
|
177
|
+
# Examples:
|
178
|
+
# load the "de" built-in locale:
|
179
|
+
# Pagy::I18n.load(locale: 'de')
|
180
|
+
#
|
181
|
+
# load the "de" locale defined in the custom file at :filepath:
|
182
|
+
# Pagy::I18n.load(locale: 'de', filepath: 'path/to/pagy-de.yml')
|
183
|
+
#
|
184
|
+
# load the "de", "en" and "es" built-in locales:
|
185
|
+
# (the first passed :locale will be used also as the default_locale)
|
186
|
+
# Pagy::I18n.load({locale: 'de'},
|
187
|
+
# {locale: 'en'},
|
188
|
+
# {locale: 'es'})
|
189
|
+
#
|
190
|
+
# load the "en" built-in locale, a custom "es" locale,
|
191
|
+
# and a totally custom locale complete with a custom :pluralize proc:
|
192
|
+
# (the first passed :locale will be used also as the default_locale)
|
193
|
+
# Pagy::I18n.load({locale: 'en'},
|
194
|
+
# {locale: 'es', filepath: 'path/to/pagy-es.yml'},
|
195
|
+
# {locale: 'xyz', # not built-in
|
196
|
+
# filepath: 'path/to/pagy-xyz.yml',
|
197
|
+
# pluralize: lambda{ |count| ... } )
|
198
|
+
|
199
|
+
|
200
|
+
# I18n extra: uses the standard i18n gem which is ~18x slower using ~10x more memory
|
201
|
+
# than the default pagy internal i18n (see above)
|
202
|
+
# See https://ddnexus.github.io/pagy/extras/i18n
|
203
|
+
# require 'pagy/extras/i18n'
|
204
|
+
|
205
|
+
# Default i18n key
|
206
|
+
# Pagy::DEFAULT[:i18n_key] = 'pagy.item_name' # default
|
207
|
+
|
208
|
+
|
209
|
+
# When you are done setting your own defaults freeze it,
|
210
|
+
# so it will not changed accidentally
|
211
|
+
Pagy::DEFAULT.freeze
|
data/package.json
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
{
|
2
|
+
"name": "@modgeosys/bulma_form_rails",
|
3
|
+
"version": "0.9.1",
|
4
|
+
"description": "Stimulus controllers for BulmaFormRails Gem",
|
5
|
+
"module": "lib/javascript/controllers/index.js",
|
6
|
+
"main": "lib/javascript/controllers/index.js",
|
7
|
+
"files": [
|
8
|
+
"lib/javascript/controllers"
|
9
|
+
],
|
10
|
+
"scripts": {
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
12
|
+
},
|
13
|
+
"dependencies": {
|
14
|
+
"@hotwired/turbo": "^7.1.0",
|
15
|
+
"stimulus": "^3.0.1",
|
16
|
+
"@rails/request.js": "^0.0.6",
|
17
|
+
"bulma": "^0.9.4",
|
18
|
+
"bulma-popover": "^1.1.1",
|
19
|
+
"bulmahead": "^1.3.0"
|
20
|
+
},
|
21
|
+
"repository": {
|
22
|
+
"type": "git",
|
23
|
+
"url": "git+https://github.com/modgeosys/bulma_form_rails.git"
|
24
|
+
},
|
25
|
+
"keywords": [
|
26
|
+
"turbo",
|
27
|
+
"stimulus",
|
28
|
+
"bulma",
|
29
|
+
"form",
|
30
|
+
"rails",
|
31
|
+
"js"
|
32
|
+
],
|
33
|
+
"author": "Modern geoSystems",
|
34
|
+
"contributors": [
|
35
|
+
{
|
36
|
+
"name": "Kevin Weller",
|
37
|
+
"email": "kweller@moderngeosystems.com"
|
38
|
+
}
|
39
|
+
],
|
40
|
+
"license": "BSD-3-Clause",
|
41
|
+
"bugs": {
|
42
|
+
"url": "https://github.com/modgeosys/bulma_form_rails/issues"
|
43
|
+
},
|
44
|
+
"homepage": "https://github.com/modgeosys/bulma_form_rails#readme"
|
45
|
+
}
|