polaris_view_helpers 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +34 -0
- data/app/views/polaris/_annotated_section_text_field.html.erb +34 -0
- data/app/views/polaris/_banner.html.erb +13 -0
- data/app/views/polaris/_banner_actions.html.erb +7 -0
- data/app/views/polaris/_button_link_to.html.erb +3 -0
- data/app/views/polaris/_button_tag.html.erb +3 -0
- data/app/views/polaris/_model_errors.html.erb +10 -0
- data/app/views/polaris/_page_actions.html.erb +22 -0
- data/app/views/polaris/banner_icons/_critical.html.erb +3 -0
- data/app/views/polaris/banner_icons/_success.html.erb +3 -0
- data/app/views/polaris/banner_icons/_warning.html.erb +3 -0
- data/lib/polaris_view_helpers.rb +8 -0
- data/lib/polaris_view_helpers/helper.rb +83 -0
- data/lib/polaris_view_helpers/version.rb +3 -0
- data/lib/tasks/polaris_view_helpers_tasks.rake +4 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +5 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/polaris_view_helpers_test.rb +7 -0
- data/test/test_helper.rb +20 -0
- metadata +165 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6ffb4874256c1072a5148ff4b2637e6554629dd1
|
4
|
+
data.tar.gz: d08189d0f3f2b830eb356630434b4743d71f4895
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 71fc47724d5faddcf01e47d2bc749344e959cc0287cd177bdf6cd1c3393a2b36141675be7d4150777fb8a23f7534e977939c0cf94565bfc2a42e92202a96dde0
|
7
|
+
data.tar.gz: 9f086d43e4e1c459554c12df33bff08763b9f8f587b27bfbac34c8463232117d1cfe953f928c2f53309b656e611fd56eaa872175330a3fc101566e958dfcb523
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 Jeremy Green
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'PolarisViewHelpers'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<div class="Polaris-Layout__AnnotatedSection">
|
2
|
+
<div class="Polaris-Layout__AnnotationWrapper">
|
3
|
+
<div class="Polaris-Layout__Annotation">
|
4
|
+
<div class="Polaris-TextContainer">
|
5
|
+
<%= capture(&block) %>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
<div class="Polaris-Layout__AnnotationContent">
|
9
|
+
<div class="Polaris-Card">
|
10
|
+
<div class="Polaris-Card__Section">
|
11
|
+
<div class="Polaris-FormLayout">
|
12
|
+
|
13
|
+
<% attribute.each do |att| %>
|
14
|
+
<div class="Polaris-FormLayout__Item">
|
15
|
+
<div class="">
|
16
|
+
<div class="Polaris-Labelled__LabelWrapper">
|
17
|
+
<div class="Polaris-Label">
|
18
|
+
<%= form.label att, class: 'Polaris-Label__Text' %>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
<div class="Polaris-TextField">
|
22
|
+
<%= form.send element_type, att, id: "#{form.object.class.name.tableize.singularize}_#{att}", class: "Polaris-TextField__Input" %>
|
23
|
+
<div class="Polaris-TextField__Backdrop"></div>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="Polaris-Banner Polaris-Banner--status<%= options[:status].titleize %>" tabindex="0" role="banner <%= options[:status] %>" aria-labelledby="Banner2Heading" aria-describedby="Banner2Content">
|
2
|
+
<div class="Polaris-Banner__Ribbon">
|
3
|
+
<%= render "polaris/banner_icons/#{options[:status]}" %>
|
4
|
+
</div>
|
5
|
+
<div>
|
6
|
+
<div class="Polaris-Banner__Heading" id="Banner2Heading">
|
7
|
+
<p class="Polaris-Heading"><%= options[:title] %></p>
|
8
|
+
</div>
|
9
|
+
<div class="Polaris-Banner__Content" id="Banner2Content">
|
10
|
+
<%= capture(&block) %>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
</div>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if model.errors.any? %>
|
2
|
+
<%= polaris_banner status: 'critical', title: "#{ pluralize(model.errors.count, "error") } prohibited this #{ model.class.name.humanize } from being saved" do %>
|
3
|
+
<ul>
|
4
|
+
<% model.errors.full_messages.each do |message| %>
|
5
|
+
<li><%= message %></li>
|
6
|
+
<% end %>
|
7
|
+
</ul>
|
8
|
+
<% end %>
|
9
|
+
<p> </p>
|
10
|
+
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<div class="Polaris-PageActions">
|
2
|
+
<div class="Polaris-Stack Polaris-Stack--spacingTight Polaris-Stack--distributionEqualSpacing">
|
3
|
+
<div class="Polaris-Stack__Item">
|
4
|
+
<% if left.is_a? Array %>
|
5
|
+
<% left.each do |item| %>
|
6
|
+
<%= item %>
|
7
|
+
<% end %>
|
8
|
+
<% else %>
|
9
|
+
<%= left %>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
12
|
+
<div class="Polaris-Stack__Item">
|
13
|
+
<% if right.is_a? Array %>
|
14
|
+
<% right.each do |item| %>
|
15
|
+
<%= item %>
|
16
|
+
<% end %>
|
17
|
+
<% else %>
|
18
|
+
<%= right %>
|
19
|
+
<% end %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
</div>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<span class="Polaris-Icon Polaris-Icon--colorRedDark Polaris-Icon--hasBackdrop">
|
2
|
+
<svg class="Polaris-Icon__Svg" viewBox="0 0 20 20"><defs><path d="M10 0C4.486 0 0 4.486 0 10s4.486 10 10 10 10-4.486 10-10S15.514 0 10 0zm0 2.5c1.617 0 3.113.52 4.34 1.394L3.893 14.34A7.467 7.467 0 0 1 2.5 10c0-4.136 3.364-7.5 7.5-7.5zm0 15a7.459 7.459 0 0 1-4.34-1.394L16.107 5.66A7.472 7.472 0 0 1 17.5 10c0 4.136-3.364 7.5-7.5 7.5z" id="a"></path></defs><g fill-rule="evenodd"><circle fill="currentColor" cx="10" cy="10" r="9"></circle><use fill-rule="nonzero" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#a"></use></g></svg>
|
3
|
+
</span>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<span class="Polaris-Icon Polaris-Icon--colorGreenDark Polaris-Icon--hasBackdrop">
|
2
|
+
<svg class="Polaris-Icon__Svg" viewBox="0 0 20 20"><g fill-rule="evenodd"><circle fill="currentColor" cx="10" cy="10" r="9"></circle><path d="M10 0C4.486 0 0 4.486 0 10s4.486 10 10 10 10-4.486 10-10S15.514 0 10 0m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m2.293-10.707L9 10.586 7.707 9.293a1 1 0 1 0-1.414 1.414l2 2a.997.997 0 0 0 1.414 0l4-4a1 1 0 1 0-1.414-1.414"></path></g></svg>
|
3
|
+
</span>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<span class="Polaris-Icon Polaris-Icon--colorYellowDark Polaris-Icon--hasBackdrop">
|
2
|
+
<svg class="Polaris-Icon__Svg" viewBox="0 0 20 20"><g fill-rule="evenodd"><circle fill="currentColor" cx="10" cy="10" r="9"></circle><path d="M10 0C4.486 0 0 4.486 0 10s4.486 10 10 10 10-4.486 10-10S15.514 0 10 0m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-13a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0V6a1 1 0 0 0-1-1m0 8a1 1 0 1 0 0 2 1 1 0 0 0 0-2"></path></g></svg>
|
3
|
+
</span>
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module PolarisViewHelpers::Helper
|
2
|
+
|
3
|
+
def polaris_banner(options, &block)
|
4
|
+
render(
|
5
|
+
partial: 'polaris/banner',
|
6
|
+
locals: { options: options, block: block }
|
7
|
+
)
|
8
|
+
end
|
9
|
+
|
10
|
+
def polaris_banner_actions(&block)
|
11
|
+
render(
|
12
|
+
partial: 'polaris/banner_actions',
|
13
|
+
locals: { block: block }
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def polaris_button_link_to(name = nil, link_destination = nil, button_options = nil, &block)
|
18
|
+
if block_given?
|
19
|
+
button_options, link_destination, name = link_destination, name, nil
|
20
|
+
end
|
21
|
+
button_options ||= {}
|
22
|
+
|
23
|
+
additional_classes = ""
|
24
|
+
(button_options[:modifiers] || []).each do |modifier|
|
25
|
+
additional_classes += "Polaris-Button--#{modifier} "
|
26
|
+
end
|
27
|
+
render(
|
28
|
+
partial: 'polaris/button_link_to',
|
29
|
+
locals: {
|
30
|
+
name: name,
|
31
|
+
block: block,
|
32
|
+
additional_classes: additional_classes,
|
33
|
+
link_destination: link_destination,
|
34
|
+
method: button_options[:method]
|
35
|
+
}
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def polaris_model_errors model
|
40
|
+
render(
|
41
|
+
partial: 'polaris/model_errors',
|
42
|
+
locals: { model: model }
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
def polaris_page_actions(options)
|
47
|
+
render(
|
48
|
+
partial: 'polaris/page_actions',
|
49
|
+
locals: options
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
def polaris_button_tag(name, button_options)
|
54
|
+
additional_classes = ""
|
55
|
+
(button_options[:modifiers] || []).each do |modifier|
|
56
|
+
additional_classes += "Polaris-Button--#{modifier} "
|
57
|
+
end
|
58
|
+
|
59
|
+
button_options[:additional_classes] = additional_classes
|
60
|
+
button_options[:name] = name
|
61
|
+
render(
|
62
|
+
partial: 'polaris/button_tag',
|
63
|
+
locals: button_options
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
def polaris_annotated_section_text_field(form, attribute, element_type = :text_field, &block)
|
68
|
+
unless attribute.is_a? Array
|
69
|
+
attribute = [attribute]
|
70
|
+
end
|
71
|
+
|
72
|
+
render(
|
73
|
+
partial: 'polaris/annotated_section_text_field',
|
74
|
+
locals: {
|
75
|
+
form: form,
|
76
|
+
attribute: attribute,
|
77
|
+
element_type: element_type,
|
78
|
+
block: block
|
79
|
+
}
|
80
|
+
)
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|