r_kit 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWVlOGNkODQ1OTgwMzIxYWZkZTVjYjFmYzA2ZDA3NjVkMDI3ZjlmNQ==
4
+ YzM0ZTdlMTIxMWQ0NjBiNDQxMTQ5YmZlNDM5ODllN2NkOWRlYWIxOA==
5
5
  data.tar.gz: !binary |-
6
- ODBkNzVlZTM2YTEyNjBjYTZmNGJmNzIyMTg3NTNhMTMyYjRlOTMyOA==
6
+ NzA4OTljZTFlNmY2NGQ0MTY2NmNiNGFkNjBjOWYzYjY1MDAyMWM0NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Nzk4OWRiNmUzOTNiYTJmOWVmZjA5NDcwYjY4ZDZlYWFlZTAxNGU2YWY1MmY5
10
- YjU3NWRmZWQ0YTVjYWRmNzc0OTc0NWRjYWRjZjIxOTdiMWIzNTg1NTFkZmIy
11
- NDUwNTJmYzQxOTQ3Y2NlZmEwZjY2MTQyNmE5NjljN2FlODE3MTQ=
9
+ NGE1NTQ3OWM4ZDBkYjM4ZDRlYTc4YzFkNDAyMzQ0MjUwYzAwODIwZmZhNGNl
10
+ ZWNkZjlmOWI4NzZkMWRmYTNjNTA2YzA3ODZhMGVmODk2YjBiNWI1M2U5ZDY4
11
+ NmI0NWRiNjJlYzVlNDY2YWYyMGY0YWJhNWIwMTQ5OWY0NDVhMjI=
12
12
  data.tar.gz: !binary |-
13
- Y2IzYzdlOGFlN2IyYzFjMGM1Mjk1ZjJhNjFkZjgzOWYyNTQzMWMxMjc5Yzli
14
- Y2MyMDM5ZmI5NTkxNjdmNWYxZThhOWRiNzdjNTdiOThkOTIyOTk1OWFiMzI0
15
- Yzc2Njg1NTYwODU5OTEzZWZmY2M0NTFjNTQxNzI5MDI5ZDMyY2M=
13
+ NzdkNTAwZWM0Njg4MmRmYzE0OTBkNzFjM2Q2Mjc0ZDgyN2RkNmI5YjQ2ZWJi
14
+ NGMwYzE4YTA3MzU5NGUyODk5NWI5ZGE1Yjc0OWU4MzI0ZmIwMTU4MWI0MzFk
15
+ NmY5Yzc3ZDE2NmFlMzhkZGY3ZDMwYzRjNDIxNWIxM2Q5ZGY5MGU=
@@ -0,0 +1,9 @@
1
+ ul{
2
+ font-weight: 200;
3
+ line-height: 1.4em;
4
+
5
+ margin: 1.75em 0;
6
+ padding: 0;
7
+
8
+ list-style-type: none;
9
+ }
@@ -3,14 +3,8 @@ h2,
3
3
  h3{
4
4
  font-weight: 200;
5
5
  margin: 1em 0;
6
-
7
- a{
8
- @include unstyled-link();
9
-
10
- &:hover{
11
- text-decoration: none;
12
- }
13
- }
6
+
7
+ @include link-styled-title;
14
8
  }
15
9
 
16
10
  h1{
@@ -1,3 +1,4 @@
1
1
  @import "typography/links";
2
+ @import "typography/lists";
2
3
  @import "typography/paragraphs";
3
4
  @import "typography/titles";
@@ -0,0 +1,34 @@
1
+ @mixin base-horizontal-curved-shadow() {
2
+ position: absolute;
3
+ width: 90%;
4
+ height: 10%;
5
+ left: 5%;
6
+ border-radius: 50%;
7
+ z-index: -1;
8
+ content: "";
9
+ box-shadow: 0 0 1em .25em black;
10
+ }
11
+
12
+
13
+ @mixin top-curved-shadow() {
14
+ position: relative;
15
+
16
+ &:before {
17
+ @include base-horizontal-curved-shadow;
18
+ top: 0%;
19
+ }
20
+ }
21
+
22
+ @mixin bottom-curved-shadow() {
23
+ position: relative;
24
+
25
+ &:after {
26
+ @include base-horizontal-curved-shadow;
27
+ bottom: 0%;
28
+ }
29
+ }
30
+
31
+ @mixin horizontal-curved-shadow() {
32
+ @include top-curved-shadow;
33
+ @include bottom-curved-shadow;
34
+ }
@@ -0,0 +1,3 @@
1
+ @mixin normal-box-shadow() {
2
+ box-shadow: 0 0 1em black;
3
+ }
@@ -0,0 +1,2 @@
1
+ @import "box-shadows/curved-shadows";
2
+ @import "box-shadows/straight-shadows";
@@ -0,0 +1,18 @@
1
+ @mixin link-styled-title() {
2
+ a{
3
+ @include unstyled-link();
4
+
5
+ &:hover{
6
+ opacity: .75;
7
+ text-decoration: none;
8
+ }
9
+ }
10
+ }
11
+
12
+ @mixin link-unstyled-title() {
13
+ a{
14
+ &:hover{
15
+ opacity: 1;
16
+ }
17
+ }
18
+ }
@@ -1,2 +1,4 @@
1
- @import "mixins/keyframes";
2
1
  @import "mixins/animation";
2
+ @import "mixins/box-shadows";
3
+ @import "mixins/keyframes";
4
+ @import "mixins/titles";
@@ -20,6 +20,7 @@ $text-info-color
20
20
  $text-muted-color
21
21
  */
22
22
  $background-color: #111 !default;
23
+ $background-alt-color: #181818 !default;
23
24
  /*$background-success-color
24
25
  $background-warning-color
25
26
  $background-danger-color
@@ -0,0 +1,15 @@
1
+ class Object
2
+ core_extend :__class__ do
3
+ self.class
4
+ end
5
+
6
+ # should be able to use the method from "super"
7
+ #core_extend :super_method do |method_name|
8
+ # __class__.superclass.instance_method(method_name).bind(self).call
9
+ #end
10
+ # no working in prod context (seriable decarator, :title method)
11
+
12
+ core_extend :to_boolean do
13
+ ActiveRecord::ConnectionAdapters::Column.value_to_boolean self
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ module RKit::Core::ObjectExtension
2
+ def core_extend method_name, *args, &block
3
+ unless method_defined? method_name
4
+ define_method method_name, *args, &block
5
+ end
6
+ end
7
+ end
data/lib/r_kit/core.rb ADDED
@@ -0,0 +1,8 @@
1
+ module RKit::Core
2
+ def self.init!
3
+ require "r_kit/core/object_extension"
4
+ Object.extend ObjectExtension
5
+
6
+ require "r_kit/core/object"
7
+ end
8
+ end
@@ -18,8 +18,8 @@ module RKit::Decorator::ActiveRecordExtension
18
18
  end
19
19
 
20
20
  module InstanceMethods
21
- def decorate view_context
22
- self.class.decorator_class.new self, view_context
21
+ def decorate view_context, instance_variables = {}
22
+ self.class.decorator_class.new self, view_context, instance_variables
23
23
  end
24
24
  end
25
25
  end
@@ -1,12 +1,18 @@
1
1
  require 'delegate'
2
2
 
3
3
  class RKit::Decorator::Base < SimpleDelegator
4
- def initialize base, view_context
4
+ alias :_base :__getobj__
5
+
6
+ def initialize base, view_context, instance_variables = {}
5
7
  @view_context = view_context
6
8
 
9
+ instance_variables.each do |key, value|
10
+ instance_variable_set "@#{ key }", value
11
+ end
12
+
7
13
  super(base)
8
14
  end
9
-
15
+
10
16
  def _h
11
17
  @view_context
12
18
  end
@@ -7,8 +7,14 @@ module RKit::Grid::ActionViewExtension
7
7
 
8
8
  def html_options options = {}, defaults = {}
9
9
  id = options[:id]
10
- classes = "#{ defaults[:class] } #{ options[:class] }"
11
- classes += " off-#{ options[:offset] }" if options[:offset]
10
+
11
+ classes = [defaults[:class], options[:class]]
12
+ classes << "off-#{ options[:offset] }" if options[:offset]
13
+ classes = classes
14
+ .compact
15
+ .map(&:to_s)
16
+ .map(&:dasherize)
17
+ .join " "
12
18
 
13
19
  {
14
20
  :id => id,
@@ -31,7 +37,7 @@ module RKit::Grid::ActionViewExtension
31
37
  proc_options options[:instance], options
32
38
  html_options = html_options(options, {class: "col-#{ options[:col_size] }"})
33
39
 
34
- content_tag(options[:tag] || :div, html_options){ block.call(options[:instance]) }
40
+ content_tag(options[:tag] || :div, html_options){ block.call(*options[:instance]) }
35
41
  end
36
42
 
37
43
 
@@ -51,6 +57,7 @@ module RKit::Grid::ActionViewExtension
51
57
 
52
58
  def rows__tag col_size, collection, options = {}, &block
53
59
  rows_buffer = collection
60
+ .to_a
54
61
  .in_groups_of(12 / col_size, false)
55
62
  .inject ActiveSupport::SafeBuffer.new do |safe_buffer, collection|
56
63
  safe_buffer.safe_concat send("row_#{ col_size }_tag", collection, options, &block)
data/lib/r_kit/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RKit
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/r_kit.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "r_kit/version"
2
2
  require "r_kit/engine"
3
3
 
4
+ require "r_kit/core"
4
5
  require "r_kit/decorator"
5
6
  require "r_kit/grid"
6
7
 
@@ -15,7 +16,8 @@ module RKit
15
16
  const_get const_name
16
17
  end
17
18
  end
18
-
19
+
20
+ # rename add_service ???
19
21
  def init_all!
20
22
  services.each do |service|
21
23
  if service.respond_to? :init!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Petrachi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-13 00:00:00.000000000 Z
11
+ date: 2014-02-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Library for rails projects
14
14
  email:
@@ -39,16 +39,24 @@ files:
39
39
  - lib/assets/stylesheets/r_kit/css/html.scss
40
40
  - lib/assets/stylesheets/r_kit/css/typography.scss
41
41
  - lib/assets/stylesheets/r_kit/css/typography/links.scss
42
+ - lib/assets/stylesheets/r_kit/css/typography/lists.scss
42
43
  - lib/assets/stylesheets/r_kit/css/typography/paragraphs.scss
43
44
  - lib/assets/stylesheets/r_kit/css/typography/titles.scss
44
45
  - lib/assets/stylesheets/r_kit/mixins.scss
45
46
  - lib/assets/stylesheets/r_kit/mixins/animation.scss
47
+ - lib/assets/stylesheets/r_kit/mixins/box-shadows.scss
48
+ - lib/assets/stylesheets/r_kit/mixins/box-shadows/curved-shadows.scss
49
+ - lib/assets/stylesheets/r_kit/mixins/box-shadows/straight-shadows.scss
46
50
  - lib/assets/stylesheets/r_kit/mixins/keyframes.scss
51
+ - lib/assets/stylesheets/r_kit/mixins/titles.scss
47
52
  - lib/assets/stylesheets/r_kit/variables.scss
48
53
  - lib/assets/stylesheets/r_kit/variables/application.scss
49
54
  - lib/assets/stylesheets/r_kit/variables/colors.scss
50
55
  - lib/assets/stylesheets/r_kit/variables/typography.scss
51
56
  - lib/r_kit.rb
57
+ - lib/r_kit/core.rb
58
+ - lib/r_kit/core/object.rb
59
+ - lib/r_kit/core/object_extension.rb
52
60
  - lib/r_kit/decorator.rb
53
61
  - lib/r_kit/decorator/active_record_extension.rb
54
62
  - lib/r_kit/decorator/base.rb