ffp 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f746cfc063fe5d0c2e8274c0003b8d8e6ad8325d
4
+ data.tar.gz: bdf6f7966ba00a629f4beee83449085cdc9247a0
5
+ SHA512:
6
+ metadata.gz: a5b08c0fad04d27b4c221a1c68e564eb22a1541d9f34ed11189df16e46c2025d25263df6b42f4ae8c5e87e0833fcbb8a5bf90464ca73245322abb6335d392834
7
+ data.tar.gz: ea40ea9e3236374f916f722bcc06fa20e07a632b04a84bc8b3416fe669cc81ba3523ff8fb2a5d688c99c3786b47d6bd91c7b2dc39e0f97def1d074d16c8f46db
@@ -0,0 +1,10 @@
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
+ Bundler::GemHelper.install_tasks
10
+
@@ -0,0 +1,4 @@
1
+ require "ffp/presenter"
2
+
3
+ module Ffp
4
+ end
@@ -0,0 +1,11 @@
1
+ module Ffp
2
+ module Flash
3
+ def assign_flash_presenter
4
+ @flash = ::Ffp::Presenter.new(flash)
5
+ end
6
+
7
+ def self.included(base)
8
+ base.before_action :assign_flash_presenter
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,46 @@
1
+ module Ffp
2
+ class Presenter
3
+ include ActionView::Helpers
4
+
5
+ ALERT_TYPES = %w(success warning info alert secondary)
6
+
7
+ def initialize(flash)
8
+ @flash = flash
9
+ end
10
+
11
+
12
+ def for_foundation
13
+ flash_messages = Array.new
14
+
15
+ @flash.each do |type, message|
16
+ next if message.blank?
17
+
18
+ type = "success" if type == "notice"
19
+ next unless ALERT_TYPES.include?(type)
20
+
21
+ Array(message).each do |msg|
22
+ flash_messages << content_tag(
23
+ :div,
24
+ msg.html_safe + content_tag(:a, raw("&times;"), :class => 'close'),
25
+ :class => css_classes_for_type(type),
26
+ :'data-alert' => true
27
+ )
28
+ end
29
+ end
30
+
31
+ flash_messages.join("\n").html_safe
32
+ end
33
+
34
+ ################################################################################
35
+ private
36
+ ################################################################################
37
+ def css_classes_for_type(type)
38
+ ks = []
39
+ ks << 'alert-box'
40
+ ks << 'radius'
41
+ ks << type
42
+
43
+ ks.join(" ")
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,3 @@
1
+ module Ffp
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ffp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Rob Yurkowski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: actionview
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.1.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.1.4
27
+ description:
28
+ email:
29
+ - rob@yurkowski.net
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - Rakefile
35
+ - lib/ffp.rb
36
+ - lib/ffp/flash.rb
37
+ - lib/ffp/presenter.rb
38
+ - lib/ffp/version.rb
39
+ homepage: https://github.com/robyurkowski/ffp
40
+ licenses:
41
+ - MIT
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 2.4.5
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: Quick extraction of foundation flash presenter
63
+ test_files: []