faalis 0.24.4 → 0.25.0

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/faalis/dashboard/modules/auth/group.js +7 -1
  3. data/app/assets/javascripts/faalis/dashboard/modules/fields/relation.js +50 -3
  4. data/app/assets/stylesheets/faalis/base.css.scss +16 -1
  5. data/app/assets/stylesheets/faalis/ltr/foundation_and_overrides.scss +4 -0
  6. data/app/assets/stylesheets/faalis/rtl/foundation_and_overrides.css.scss +1 -1
  7. data/app/assets/stylesheets/faalis/variables.css.scss +1 -1
  8. data/app/controllers/faalis/#api_controller.rb# +144 -0
  9. data/app/controllers/faalis/api/v1/#conversations_controller.rb# +120 -0
  10. data/app/controllers/faalis/api/v1/workflows_controller.rb +18 -0
  11. data/app/controllers/faalis/api_controller.rb +3 -3
  12. data/app/controllers/faalis/application_controller.rb +0 -1
  13. data/app/models/faalis/workflow.rb +4 -0
  14. data/app/views/angularjs_templates/auth/groups/new.html +47 -25
  15. data/app/views/angularjs_templates/fields/relation/relation.html +9 -2
  16. data/app/views/devise/sessions/new.html.erb +52 -88
  17. data/app/views/faalis/api/v1/workflows/index.json.jbuilder +5 -0
  18. data/app/views/faalis/home/index.html.erb +14 -11
  19. data/app/views/layouts/faalis/application.html.erb +21 -30
  20. data/app/views/layouts/faalis/simple.html.erb +37 -0
  21. data/app/workflows/faalis/administration_workflow.rb +7 -0
  22. data/config/routes.rb +15 -13
  23. data/db/migrate/20140413180202_create_faalis_workflows.rb +9 -0
  24. data/db/seeds.rb +17 -13
  25. data/lib/faalis.rb +12 -10
  26. data/lib/faalis/engine.rb +9 -8
  27. data/lib/faalis/generators/concerns.rb +15 -13
  28. data/lib/faalis/generators/concerns/bulk.rb +2 -5
  29. data/lib/faalis/generators/concerns/fieldset.rb +48 -0
  30. data/lib/faalis/generators/concerns/resource_fields.rb +43 -45
  31. data/lib/faalis/generators/concerns/where.rb +46 -0
  32. data/lib/faalis/generators/dashboard_scaffold.rb +6 -5
  33. data/lib/faalis/version.rb +1 -1
  34. data/lib/faalis/workflows.rb +7 -0
  35. data/lib/faalis/workflows/base.rb +69 -0
  36. data/lib/faalis/workflows/discovery.rb +42 -0
  37. data/lib/generators/faalis/templates/js/list_view/new.html.erb +7 -5
  38. data/lib/tasks/sync.rake +10 -0
  39. data/spec/factories/faalis_workflows.rb +7 -0
  40. data/spec/models/faalis/workflow_spec.rb +7 -0
  41. metadata +36 -4
@@ -0,0 +1,18 @@
1
+ require_dependency "faalis/application_controller"
2
+
3
+ module Faalis
4
+ class API::V1::WorkflowsController < ::APIController
5
+
6
+ def index
7
+ workflows = Faalis::Workflow.all
8
+ @workflows = []
9
+
10
+ workflows.map do |workflow_instance|
11
+ @workflows << workflow_instance.name.constantize.new(workflow_instance)
12
+ end
13
+
14
+ respond_with(@worklows)
15
+ end
16
+
17
+ end
18
+ end
@@ -30,7 +30,7 @@ class Faalis::APIController < Faalis::ApplicationController
30
30
  respond_to :json
31
31
 
32
32
  # Authenticate user before any action take place
33
- before_filter :authenticate
33
+ before_filter :authenticate_filter
34
34
 
35
35
  # Check for any presence of filtering query, In querystring and load
36
36
  # resource using them
@@ -63,7 +63,7 @@ class Faalis::APIController < Faalis::ApplicationController
63
63
  #
64
64
  # If you want to change authentication method ? just override this method
65
65
  # in you **APIController**
66
- def authenticate
66
+ def authenticate_filter
67
67
  authenticate_user!
68
68
  end
69
69
 
@@ -71,7 +71,7 @@ class Faalis::APIController < Faalis::ApplicationController
71
71
  def load_resource_by_query
72
72
  # If any query string parameter provided and allow fields specified
73
73
  if not request.query_parameters.empty? and not allowed_fields.empty?
74
- #load_resource
74
+
75
75
  logger.info ("Load resource by query parameters")
76
76
  # Iterate over parameters in query string
77
77
  request.query_parameters.each do |key, value|
@@ -20,7 +20,6 @@ class Faalis::ApplicationController < ActionController::Base
20
20
  include FastGettext::Translation
21
21
  before_filter :set_locale
22
22
 
23
-
24
23
  def set_locale
25
24
  FastGettext.add_text_domain 'faalis', :path => "#{Faalis::Engine.root}/config/locales", :type => :po
26
25
  # All languages you want to allow
@@ -0,0 +1,4 @@
1
+ module Faalis
2
+ class Workflow < ActiveRecord::Base
3
+ end
4
+ end
@@ -1,45 +1,67 @@
1
1
  <div class="newform">
2
- <form name="from" novalidate>
2
+ <form name="from" novalidate>
3
3
 
4
- <fieldset class="form">
4
+ <fieldset class="form">
5
5
 
6
- <legend ng-if="!editing"><span translate>New Group</span></legend>
7
- <legend ng-if="editing"><span translate>Edit Group</span></legend>
6
+ <legend ng-if="!editing"><span translate>New Group</span></legend>
7
+ <legend ng-if="editing"><span translate>Edit Group</span></legend>
8
8
 
9
- <div class="row">
10
- <div class="small-4 columns">
11
- <label translate>Name :</label>
12
- <input id="id_name" ng-model="new_name" type="text" required>
13
- <small id="id_name_msg"></small>
14
- </div>
15
- </div>
9
+ <div class="row">
10
+ <div class="small-4 columns">
11
+ <label translate>Name :</label>
12
+ <input id="id_name" ng-model="new_name" type="text" required>
13
+ <small id="id_name_msg"></small>
14
+ </div>
15
+ </div>
16
+ </fieldset>
16
17
 
17
- <div class="row">
18
- <label for="permissions" translate>Permissions</label>
18
+ <fieldset>
19
+ <legend translate>Workflows</legend>
20
+ <div class="row">
21
+ <div class="small-12 columns">
22
+ <p translate>Choose any workflow which you want to allow user to have access to.</p>
23
+ </div>
24
+ </div>
25
+ <div class="row">
26
+ <div class="small-2 columns text-center" ng-repeat="workflow in workflows">
19
27
 
20
- <div class="small-10 columns permissions">
28
+ <span class="fa-stack fa-2x" ng-if="workflow.have_icon == true">
29
+ <i class="fa fa-circle fa-stack-2x"></i>
30
+ <i class="{{ workflow.icon }} fa-stack-1x fa-inverse"></i>
31
+ </span>
32
+ <img ng-src="workflow.image" ng-if="workflow.have_iamge == true"/>
33
+ <span>{{ workflow.title }}</span>
34
+ </div>
35
+ </div>
36
+ </fieldset>
21
37
 
38
+ <fieldset>
39
+ <legend translate>Advance Permissions</legend>
22
40
  <div class="row">
23
- <div id="id_permissions" class="small-8 columns field">
24
- <ul>
41
+ <label for="permissions" translate>Permissions</label>
42
+ </div>
43
+
44
+ <div class="small-10 columns permissions">
45
+
46
+ <div class="row">
47
+ <div id="id_permissions" class="small-8 columns field">
48
+ <ul>
25
49
 
26
50
  <li ng-repeat="permission in permissions" id="{{permission.name}}" ng-click="select_permission(permission)"> <i ng-show="is_selected(permission)" class="fa fa-check"></i> {{ permission.string }} </li>
27
51
 
28
- </ul>
52
+ </ul>
53
+ </div>
54
+ <small id="id_permissions_msg"></small>
29
55
  </div>
30
- <small id="id_permissions_msg"></small>
31
56
  </div>
32
- </div>
33
- </div>
34
- </fieldset>
35
-
57
+ </fieldset>
36
58
 
37
- <div class="row">
59
+ <div class="row">
38
60
  <div class="small-6 columns">
39
61
  <button class="btn small green" ng-click="save()" ng-disabled="form.$invalid"><i class="fa fa-check"></i> <span translate>Save</span></button>
40
62
  <button class="btn small red" ng-click="cancel()"><i class="fa fa-times"></i><span translate>Cansel</span></button>
41
63
  </div>
42
- </div>
43
- </form>
64
+ </div>
65
+ </form>
44
66
 
45
67
  </div>
@@ -8,15 +8,22 @@
8
8
  <option ng-repeat="item in all_options" value="{{ item.id }}" title="{{ item[titleField] || item }}" ng-selected="have(item.id)">{{ item[titleField] || item }}</option>
9
9
  </select>
10
10
 
11
- <select ui-select2="options" id="{{ element_id }}" ng-model="model" name="{{ field.name }}" data-placeholder="{{ placeholder }}" ng-required="required" ng-if="field.type === 'in'" ng-change="on_select_change()">
11
+ <select ui-select2="options" id="{{ element_id }}" ng-model="model" name="{{ field.name }}" data-placeholder="{{ placeholder }}" ng-required="required" ng-if="(field.type === 'in') && (multiple() == false)" ng-change="on_select_change()">
12
12
  <option ng-repeat="item in field.choices" value="{{ item.name }}" title="{{ item.title }}" ng-selected="model === item.name">{{ item.title }}</option>
13
13
  </select>
14
+ <select ui-select2="options" id="{{ element_id }}" ng-model="model" name="{{ field.name }}" data-placeholder="{{ placeholder }}" ng-required="required" ng-if="(field.type === 'in') && (multiple() == true)" multiple ng-change="on_select_change()">
15
+ <option ng-repeat="item in field.choices" value="{{ item.name }}" title="{{ item.title }}" ng-selected="model === item.name">{{ item.title }}</option>
16
+ </select>
17
+
18
+
19
+
14
20
 
15
21
  <!-- Add and Refresh buttons -->
16
22
  <div class="float-left">
17
23
  <span class="helptext" ng-if="options.help_text && show_help_text">{{ options.help_text }}</span>
18
24
  </div>
19
- <div class="float-right relation_links" ng-if="(field.type === 'belongs_to') || (field.type === 'has_many')">
25
+ <div class="float-right relation_links" ng-if="((field.type === 'belongs_to') || (field.type === 'has_many')) && show_buttons() ">
26
+
20
27
  <span ng-click="help_btn_clicked()" ng-if="show_help_btn">
21
28
  <i class="fa fa-question"></i>
22
29
  </span>
@@ -1,98 +1,62 @@
1
- <div class="wrapper_signin">
2
- <div class="row">
3
- <div class="layout_signin">
4
- <div class="row">
5
- <div class="large-7 columns">
6
-
7
- <h1><%= _("Sign in") %></h1>
8
-
9
-
10
- <div class="justify big_box ">
11
-
12
- <i class="fa-desktop fa fa-5x"></i>
13
- <p>
14
- <%= _("For sign in enter your information !") %>
15
- </p>
16
- </div>
17
- <div class="inline">
18
- <div class="justify large-5 left ">
19
- <i class="fa-eye fa fa-5x"></i>
20
- <p>
21
- <%= _("you can use members area with registratio") %>
22
- </p>
23
- </div>
24
-
25
- <div class="justify large-5 right">
26
- <i class="fa-bar-chart-o fa fa-5x"></i>
27
- <p>
28
- <%= _("Its simple to register this site") %>
29
- </p>
30
- </div>
31
- </div>
32
- </div>
33
- <div class="large-4 columns">
34
- <div class="row">
35
- <section id="form_signin">
36
- <div id="formbox_login" class="panel radius form">
37
- <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
38
-
39
- <%= devise_error_messages! %>
40
- <div class="field">
41
- <label><%=_("E-mail") %></label>
42
- <%= f.email_field :email, :autofocus => true, :type => "text", :class => " input email ", :placeholder=>_("E-mail") %>
43
- <% if resource.errors[:email] -%>
44
- <dd class="danger abel"><%= resource.errors[:first_name][0]%></dd>
45
- <% end -%>
46
-
47
- </div>
48
-
49
- <div class="field">
50
- <label><%=_("Password") %></label>
51
- <%= f.password_field :password, :class => "input password" %>
52
- <% if resource.errors[:first_name] -%>
53
- <dd class="danger abel"><%= resource.errors[:first_name][0] %></dd> <% end -%>
54
-
55
- </div>
56
- <div class="field">
57
- <% if devise_mapping.rememberable? -%>
58
- <div><%= f.check_box :remember_me, :class=>"checkbox" %> <%= f.label _("remember me") %></div>
59
- <% end %>
60
- </div>
61
- <div class="submit">
62
- <%= f.submit _(" Sign in "), :class => "button"%><br><br>
63
-
64
- <%= render "devise/shared/links" %>
65
- </div>
1
+ <div class="row single-form">
2
+
3
+ <div class="small-6 columns">
4
+ <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
5
+ <fieldset>
6
+ <legend><%= _("Sign In") %></legend>
7
+ <%= devise_error_messages! %>
8
+ <div class="field">
9
+ <%= f.email_field :email, :autofocus => true, :class => "input email", :placeholder=>_("E-mail") %>
10
+ <% if resource.errors[:email] -%>
11
+ <dd class="danger abel"><%= resource.errors[:email][0]%></dd>
12
+ <% end -%>
13
+
14
+ </div>
15
+
16
+ <div class="field">
17
+ <%= f.password_field :password, :class => "input password", :placeholder=>_("Password") %>
18
+ <% if resource.errors[:password] -%>
19
+ <dd class="danger abel"><%= resource.errors[:password][0] %></dd>
20
+ <% end %>
21
+ </div>
22
+ <div class="field">
23
+ <% if devise_mapping.rememberable? -%>
24
+ <div><%= f.check_box :remember_me, :class=>"checkbox" %> <%= f.label _("Remember me") %></div>
25
+ <% end %>
26
+ </div>
27
+
28
+ <div class="right submit">
29
+ <%= f.submit _("Sign in"), :class => "button"%><br><br>
30
+ </div>
31
+ <%= render "devise/shared/links" %>
32
+
33
+ </fieldset>
34
+
35
+ <% end %>
36
+ </div>
66
37
 
67
- <% end %>
68
- </div>
69
- </section>
70
- </div>
71
38
 
72
- <br />
73
- <div class="form row panel radius">
39
+ <div class="small-6 columns">
40
+ <div class="row">
41
+ <fieldset>
74
42
 
75
- <h3><%= _("Login using") %>:</h3>
76
- <div class="text-left">
77
- <a href="/auth/google_oauth2/" class="pull_right">
78
- <i class="fa-google-plus-square fa fa-3x"></i>
79
- </a>
43
+ <legend><%= _("Login using") %>:</legend>
80
44
 
81
- <a href="/auth/facebook/" class="pull_right">
82
- <i class="fa-facebook-square fa fa-3x"></i>
83
- </a>
45
+ <div class="text-left">
46
+ <a href="/auth/google_oauth2/" class="pull_right">
47
+ <i class="fa-google-plus-square fa fa-3x"></i>
48
+ </a>
84
49
 
85
- <a href="/auth/twitter/" class="pull_right">
86
- <i class="fa-twitter-square fa fa-3x"></i>
87
- </a>
88
- </div>
89
- </div>
50
+ <a href="/auth/facebook/" class="pull_right">
51
+ <i class="fa-facebook-square fa fa-3x"></i>
52
+ </a>
90
53
 
91
- </div>
54
+ <a href="/auth/twitter/" class="pull_right">
55
+ <i class="fa-twitter-square fa fa-3x"></i>
56
+ </a>
57
+ </div>
58
+ </fieldset>
92
59
 
93
- </div>
94
60
  </div>
95
-
96
- <br><br>
97
61
  </div>
98
62
  </div>
@@ -0,0 +1,5 @@
1
+ json.array! @workflows do |workflow|
2
+ json.extract! workflow, :id, :title, :icon, :image
3
+ json.have_icon workflow.icon?
4
+ json.have_image workflow.image?
5
+ end
@@ -97,20 +97,23 @@
97
97
 
98
98
  <div class="large-4 columns hide-for-small">
99
99
 
100
+ <% unless user_signed_in? %>
100
101
  <h4>Get In Touch!</h4><hr/>
101
102
 
102
- <a href="<%= faalis.new_user_registration_path %>" class="btn-big">
103
- <div class="panel radius callout" align="center">
104
- <strong><%= _("Sign UP") %></strong>
105
- </div>
106
- </a>
107
-
108
- <a href="<%= faalis.user_session_path %>" class="btn-big">
109
- <div class="panel radius callout" align="center">
110
- <strong><%= _("Sign In") %></strong>
111
- </div>
112
- </a>
103
+ <div class="row">
104
+ <a href="<%= faalis.new_user_registration_path %>" class="success button large large-12 columns">
105
+ <i class="fa fa-user"></i> <strong><%= _("Sign UP") %></strong>
106
+ </a>
107
+ </div>
113
108
 
109
+ <div class="row">
110
+ <a href="<%= faalis.user_session_path %>" class="large large-12 columns button">
111
+ <i class="fa fa-sign-in"></i> <strong><%= _("Sign In") %></strong>
112
+ </a>
113
+ </div>
114
+ <% else %>
115
+ <p>Checkout dashboard section.</p>
116
+ <% end %>
114
117
  </div>
115
118
 
116
119
  <!-- End Content -->
@@ -3,18 +3,16 @@
3
3
  <head>
4
4
  <title><%= Faalis::Engine.site_title %></title>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <%= stylesheet_link_tag Faalis::I18n.direction(I18n.locale) + "/application", media: "all" %>
6
+ <%= stylesheet_link_tag Faalis::I18n.direction(I18n.locale) + "/application", media: "all" %>
7
7
  <%= javascript_include_tag :modernizr %>
8
8
  <%= csrf_meta_tags %>
9
9
  </head>
10
10
  <body>
11
11
  <div class="header">
12
12
  <div class="large-12 columns">
13
- <div class="">
14
13
  <!-- Navigation -->
15
- <nav class="top-bar">
14
+ <nav class="top-bar" data-topbar>
16
15
  <ul class="title-area">
17
- <!-- Title Area -->
18
16
  <li class="name">
19
17
  <h1>
20
18
  <a href="<%= faalis.root_path %>">
@@ -22,12 +20,27 @@
22
20
  </a>
23
21
  </h1>
24
22
  </li>
25
- <li class="toggle-topbar menu-icon"><a href="#"><span>menu</span></a></li>
23
+ <li class="toggle-topbar menu-icon"><a href="#"><%= _('Menu') %></a></li>
26
24
  </ul>
27
25
 
28
26
  <section class="top-bar-section">
29
- <ul class="float-right">
30
- <li class="has-dropdown"><a href="#"> <%= _("Languages") %></a>
27
+ <!-- Right Nav Section -->
28
+ <ul class="<%= Faalis::I18n.direction(I18n.locale) == "ltr" ? "right" : "left" %>">
29
+ <% unless user_signed_in? %>
30
+ <li class="has-form"><%= link_to(faalis.new_user_registration_path, :class => "alert button expand") { content_tag(:i, "", class: "fa fa-user") + " #{_('Register')}" } %></li>
31
+
32
+ <li class="has-form"><%= link_to(faalis.user_session_path, :class => "button expand") { content_tag(:i, "", class: "fa fa-sign-in") + " #{_('Sign in')}" } %></li>
33
+ <% else %>
34
+ <li class="has-form"><%= link_to(faalis.dashboard_path, :class => "success button expand") { content_tag(:i, "", class: "fa fa-dashboard") + " #{_('Dashboard')}" }%></li>
35
+ </li>
36
+ <li class="has-form"><%= link_to(faalis.destroy_user_session_path, :class => "alert button expand", :method => :delete) { content_tag(:i, "", class: "fa fa-sign-out") + " #{_('Sign out')}" } %></li>
37
+ <% end %>
38
+ </ul>
39
+
40
+ <!-- Left Nav Section -->
41
+ <ul class="<%= Faalis::I18n.direction(I18n.locale) == "ltr" ? "left" : "right" %>">
42
+
43
+ <li class="has-dropdown"><a href="#"><i class="fa fa-flag"></i> <%= _("Languages") %></a>
31
44
  <ul class="dropdown">
32
45
  <% ::I18n.available_locales.each do |locale| %>
33
46
  <li><a href="<%= "/#{locale.to_s}/" %>"><%= locale %></a></li>
@@ -35,30 +48,11 @@
35
48
  </ul>
36
49
  </li>
37
50
 
38
- <li class="has-dropdown">
39
- <% if not user_signed_in? %>
40
- <a href="#"><%= _("Membership")%></a>
41
- <%else%>
42
- <a href="#">User<%= current_user.first_name %> <%= current_user.first_name %></a>
43
- <%end%>
44
-
45
- <ul class="dropdown">
46
- <% if user_signed_in? %>
47
- <li><a href="<%= faalis.dashboard_path %>"><%= _("Dashboard") %></a></li>
48
- <li><a href="">Change Password</a></li>
49
- <li><a href="<%= faalis.destroy_user_session_path %>" data-method="delete">Sign Out</a></li>
50
- <%else%>
51
- <li><%= link_to _("Register"), faalis.new_user_registration_path %></li>
52
- <li><%= link_to _("Sign in"), faalis.user_session_path %></li>
53
- <%end%>
54
- </ul>
55
- </li>
56
51
  </ul>
57
52
  </section>
58
53
  </nav>
59
54
 
60
55
  <!-- End Navigation -->
61
- </div>
62
56
  </div>
63
57
  </div>
64
58
 
@@ -67,9 +61,7 @@
67
61
  <%= debug I18n.locale %>
68
62
  <!-- Footer -->
69
63
 
70
- <footer class="">
71
- <div class="large-12 columns">
72
- <hr>
64
+ <footer>
73
65
  <div class="row">
74
66
  <div class="large-6 columns">
75
67
  <p>&copy; Copyright no one at all. Go to town.</p>
@@ -83,7 +75,6 @@
83
75
  </ul>
84
76
  </div>
85
77
  </div>
86
- </div>
87
78
  </footer>
88
79
  <%= javascript_include_tag "faalis/application" %>
89
80
  </body>