simple_form-dropdown_select 0.0.4 → 0.1.0

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: bb32f34278a6f96989917a44917ab75d656ea4b8
4
- data.tar.gz: 9c8227f72efce173310adff0bcd7b656a2d5ce52
3
+ metadata.gz: e7977a34a10b1d4e690bd38ed72ef27a0f5a299f
4
+ data.tar.gz: a2fba974f0eb63d5a23a0104ff92cff425d3d215
5
5
  SHA512:
6
- metadata.gz: 0ed214540f2a255e6da8e6c4f34fd4d6e73399e133203addd79932f8a5f3fb72df95e853bbf9f411bc6b372267f9f756628d079263decde86af9ae1c24b297f0
7
- data.tar.gz: 70cb76815b1e0ba59e77872fc569562aec185b6b0a031c0118738b39cc9fb9bb60ab3ab4a08ded027fb163b246b8fdc8477d0a9665f11baa570ea3ce43b24fcd
6
+ metadata.gz: fc0ccdf2e1c8e2d4f624bb92d527b7e4c51749926c50a2e0afc667d4cda9897818350326abf72172e6e9fca3ab55cc8879e7ca73856626491d0ee07e38d72ab3
7
+ data.tar.gz: 7344478fdbece2f1c83b03630f88958161b4a3f074db1eef231c61ca1a947f097db2c538d17ddc5f0e619f63b92fb97bb8783a70fb56d14c7758cd08cfa41849
data/README.md CHANGED
@@ -22,13 +22,10 @@ end
22
22
 
23
23
  ### application.js
24
24
  ```
25
- //= require simple_form-dropdown_select_input
25
+ //= require simple_form/dropdown_select
26
26
  ```
27
27
 
28
28
  ### application.css
29
29
  ```
30
- *= require simple_form-dropdown_select_input
30
+ *= require simple_form/dropdown_select
31
31
  ```
32
-
33
- ## Notes
34
- Currently does not allow `include_blank`.
@@ -21,7 +21,7 @@
21
21
  .siblings()
22
22
  .removeClass('active')
23
23
 
24
- @$toggle.text($a.find('.dropdown_select_input_title').text())
24
+ @$toggle.text($a.find('.drop_rich_head').text())
25
25
 
26
26
  $.fn.extend dropdownSelectInput: (option, args...) ->
27
27
  @each ->
@@ -35,4 +35,4 @@
35
35
  ) window.jQuery, window
36
36
 
37
37
  $ ->
38
- $(".dropdown_select_input").dropdownSelectInput()
38
+ $(".dropdown_rich").dropdownSelectInput()
@@ -1,39 +1,43 @@
1
- .dropdown_select_input {
1
+ .dropdown_rich {
2
2
  .dropdown_toggle_button {
3
3
  width: 240px;
4
4
  }
5
5
 
6
- .dropdown_menu {
7
- width: 300px;
8
-
9
- li {
10
- a {
11
- white-space: normal;
12
- padding: 6px 10px 6px 20px;
13
- }
14
-
15
- a:hover, &.active a {
16
- .dropdown_select_input_description {
17
- color: #e5e5e5;
18
- }
19
- }
20
- }
21
- }
22
-
23
6
  // Support for AutoSubmitter
24
7
  .as_indicator {
25
8
  right: -28px;
26
9
  }
27
10
  }
28
11
 
29
- .dropdown_select_input_title {
30
- font-weight: 600;
12
+ .dropdown_menu_rich {
13
+ width: 22rem;
14
+ li {
15
+ a {
16
+ white-space: normal;
17
+ padding: 0.5rem 2rem;
18
+ margin: 0;
19
+ height: auto;
20
+ }
21
+ &.all a {
22
+ height: 3rem;
23
+ line-height: 3rem;
24
+ padding: 0 2rem;
25
+ }
26
+ }
27
+ }
28
+
29
+ .drop_rich_head {
31
30
  display: block;
31
+ line-height: 1.5rem;
32
32
  }
33
33
 
34
- .dropdown_select_input_description {
34
+ .drop_rich_subhead {
35
35
  display: block;
36
- color: #aaa;
37
- font-size: 0.9rem;
36
+ color: rgba(#000,0.5);
37
+ font-size: 0.85rem;
38
38
  line-height: 1.3;
39
+ a:hover &,
40
+ .active a & {
41
+ color: rgba(#fff,0.5);
42
+ }
39
43
  }
@@ -8,18 +8,26 @@ class DropdownSelectInput < SimpleForm::Inputs::CollectionInput
8
8
  end
9
9
 
10
10
  def input
11
- content_tag(:span, class: 'dropdown dropdown_select_input') do
11
+ if options[:allow_blank]
12
+ collection.unshift(
13
+ [options[:allow_blank] == true ? 'None' : options[:allow_blank], '']
14
+ )
15
+ end
16
+
17
+ content_tag(:span, class: 'dropdown dropdown_rich') do
12
18
  @builder.hidden_field(attribute_name, input_html_options) +
13
19
  content_tag(:a, class: 'dropdown_toggle_button', 'data-toggle' => 'dropdown') { selected_option[0] } +
14
- content_tag(:ul, class: 'dropdown_menu') {
15
- collection.map do |x|
16
- content_tag(:li, class: selected_option == x ? 'active' : nil) {
17
- content_tag(:a, 'data-value' => x[1]) {
18
- content_tag(:span, class: 'dropdown_select_input_title') { x[0] } +
19
- content_tag(:span, class: 'dropdown_select_input_description') { x[2] }
20
+ content_tag(:div, class: 'dropdown_menu dropdown_menu_rich') {
21
+ content_tag(:ul, class: 'dropdown_body') {
22
+ collection.map do |x|
23
+ content_tag(:li, class: selected_option == x ? 'active' : nil) {
24
+ content_tag(:a, 'data-value' => x[1]) {
25
+ content_tag(:strong, class: 'drop_rich_head') { x[0] } +
26
+ content_tag(:span, class: 'drop_rich_subhead') { x[2] }
27
+ }
20
28
  }
21
- }
22
- end.join('').html_safe
29
+ end.join('').html_safe
30
+ }
23
31
  }
24
32
  end
25
33
  end
@@ -1,5 +1,5 @@
1
1
  module SimpleForm
2
2
  module DropdownSelect
3
- VERSION = "0.0.4"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
data/script/release ADDED
@@ -0,0 +1,38 @@
1
+ #!/bin/sh
2
+ # Tag and push a release.
3
+
4
+ set -e
5
+
6
+ # Make sure we're in the project root.
7
+
8
+ cd $(dirname "$0")/..
9
+
10
+ # Build a new gem archive.
11
+
12
+ rm -rf simple_form-dropdown_select-*.gem
13
+ gem build -q simple_form-dropdown_select.gemspec
14
+
15
+ # Make sure we're on the master branch.
16
+
17
+ (git branch | grep -q '* master') || {
18
+ echo "Only release from the master branch."
19
+ exit 1
20
+ }
21
+
22
+ # Figure out what version we're releasing.
23
+
24
+ tag=v`ls simple_form-dropdown_select-*.gem | sed 's/^simple_form-dropdown_select-\(.*\)\.gem$/\1/'`
25
+
26
+ # Make sure we haven't released this version before.
27
+
28
+ git fetch -t origin
29
+
30
+ (git tag -l | grep -q "$tag") && {
31
+ echo "Whoops, there's already a '${tag}' tag."
32
+ exit 1
33
+ }
34
+
35
+ # Tag it and bag it.
36
+
37
+ gem push simple_form-dropdown_select-*.gem && git tag "$tag" &&
38
+ git push origin master && git push origin "$tag"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form-dropdown_select
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Becker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-22 00:00:00.000000000 Z
11
+ date: 2014-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-script
@@ -85,6 +85,7 @@ files:
85
85
  - lib/simple_form/dropdown_select.rb
86
86
  - lib/simple_form/dropdown_select/engine.rb
87
87
  - lib/simple_form/dropdown_select/version.rb
88
+ - script/release
88
89
  - simple_form-dropdown_select.gemspec
89
90
  homepage: http://github.com/dobtco/simple_form-dropdown_select_input
90
91
  licenses: