fanforce-plugin-factory 2.0.0.rc15 → 2.0.0.rc16

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: 794da4cd0ff9859c513a2870f50f3354116a071e
4
- data.tar.gz: 0df04009aaab8bdc8819502a4798d22911aee0a4
3
+ metadata.gz: 21b09a1ea73d8048e81fad91617274128f0d5277
4
+ data.tar.gz: 3c3ba94227357137c371cef1c7059d15504d0a3f
5
5
  SHA512:
6
- metadata.gz: fcd01f6aca569248b3e33c087fd3694f368b379979850a1f78a6f47062f089c17053edf2d0912f249b3dae15e89bda211b6884f21f404d59a438ca1df905a8e5
7
- data.tar.gz: 2c0091d1373cd21c9eae075d946a4e9fc90c8a92eaa9d4a5536afbedb8510345815bb54e0720fdd7ca1ea4857332561e79c01b6a0e537be8e898d000950013f7
6
+ metadata.gz: 7e2600ccfff01bb278a23f81b80e71ec9b49eaf282d242454e3f2375e53cd7efc85d59815f6c538aadc7714298e150ad2951ef77fedf16854c73dd56339a0d43
7
+ data.tar.gz: 130356789529c4b38cfbc10e2a02023156d4a11445ad4f703a7969f47bbe1315d5e408d9c944f597b5cd8a2ccef7bd4d5d83735b15f8c01f8efce1981a274567
@@ -5,11 +5,12 @@ App.directive('initiativeFooter', [() ->
5
5
  initiative_name: '=initiativeName'
6
6
  saveCallback: '=save'
7
7
  prefix: '@'
8
+ button: '@?'
8
9
  }
9
10
  link: (($scope, $element, attrs) ->
10
11
 
11
12
  $scope.save = (()->
12
- $scope.saveCallback()
13
+ $scope.saveCallback($scope.initiative_name)
13
14
  )
14
15
 
15
16
  )
@@ -5,4 +5,4 @@
5
5
  %input.form-control.input-sm(type='text' ng-disabled='is_disabled' ng-model='campaign_name')
6
6
  %button.btn.btn-sm.btn-primary(ng-click='save()' ng-disabled='is_disabled')
7
7
  %i.icon-plus.icon-white
8
- Create
8
+ {{button || 'Create'}}
@@ -6,4 +6,4 @@
6
6
  %input.form-control.input-sm(type='text' ng-disabled='is_disabled' ng-model='initiative_name')
7
7
  %button.btn.btn-sm.btn-primary(ng-click='save()' ng-disabled='is_disabled || !initiative_name')
8
8
  %i.icon-plus.icon-white
9
- Create
9
+ {{button || 'Create'}}
@@ -61,6 +61,11 @@ class Fanforce::Plugin::Sinatra < Sinatra::Base
61
61
  haml :"#{factory_dir.relative_path_from(plugin_views_dir).to_s}/directive_views/#{page}"
62
62
  end
63
63
 
64
+ def partial(path, options={})
65
+ options[:css_framework] = params[:css_framework] if params[:css_framework]
66
+ haml(path.to_sym, options)
67
+ end
68
+
64
69
  def page(page, options={})
65
70
  plugin_views_dir = Pathname.new(settings.views)
66
71
 
@@ -6,6 +6,13 @@ module Fanforce::Plugin::Sinatra::RactiveHelpers
6
6
  context = create_context
7
7
 
8
8
  html = context.capture_haml(&block)
9
+ html.gsub!(/([^\s])\s*\{\{\/if}}(\s*\{\{elseif)/, '\1\2') # if/elseif
10
+ html.gsub!(/([^\s])\s*\{\{\/if}}(\s*\{\{else)/, '\1\2') # if/else
11
+ html.gsub!(/([^\s])\s*\{\{\/elseif}}(\s*\{\{elseif)/, '\1\2') # elseif/elseif
12
+ html.gsub!(/([^\s])\s*\{\{\/elseif}}(\s*\{\{else)/, '\1\2') # elseif/else
13
+ html.gsub!(/{\{\/elseif}}/, '{{/if}}') # /elseif -> /if
14
+ html.gsub!(/{\{\/else}}/, '{{/if}}') # /else -> /if
15
+
9
16
  return html if format == :html
10
17
 
11
18
  single_line_html = html.split(/\r?\n/).inject('') {|sl, l| sl += l.strip + ' ' }
@@ -13,25 +20,32 @@ module Fanforce::Plugin::Sinatra::RactiveHelpers
13
20
  matches.inject({}) {|t,m| t[m[0]] = m[1]; t }.to_json
14
21
  end
15
22
 
16
- def RACTIVE(helper, &block)
23
+ def RACTIVE(command, helper, &block)
17
24
  begin require 'haml' rescue LoadError raise 'You must have the haml gem installed to use Fanforce.compile_jquery_templates.' end
18
25
  raise ArgumentError, 'Missing block' unless block_given?
19
26
 
27
+ opener = "#{command}"
28
+ opener += " #{helper}" if helper
29
+ closer = command.gsub('#','')
30
+
20
31
  context = create_context
21
- helper = '#'+helper if helper !~ /^[#\^]/
22
- "{{#{helper}}}\n" + context.capture_haml(&block) + "{{/#{helper.gsub(/(#|\^)/,'')}}}"
32
+ "{{#{opener}}}\n" + context.capture_haml(&block).to_s.split("\n").inject('') {|html, l| html += " #{l}\n"} + "{{/#{closer}}}"
23
33
  end
24
34
 
25
35
  def IF(helper, &block)
26
- RACTIVE(helper, &block)
36
+ RACTIVE('#if', helper, &block)
27
37
  end
28
38
 
29
39
  def ELSE_IF(helper, &block)
30
- RACTIVE(helper, &block)
40
+ RACTIVE('elseif', helper, &block)
41
+ end
42
+
43
+ def ELSE(&block)
44
+ RACTIVE('else', nil, &block)
31
45
  end
32
46
 
33
47
  def FOREACH(helper, &block)
34
- RACTIVE(helper, &block)
48
+ RACTIVE("##{helper}", nil, &block)
35
49
  end
36
50
 
37
51
  def create_context
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
2
  class PluginFactory
3
- VERSION = '2.0.0.rc15'
3
+ VERSION = '2.0.0.rc16'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce-plugin-factory
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc15
4
+ version: 2.0.0.rc16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Clark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-03 00:00:00.000000000 Z
11
+ date: 2015-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake