vue_crud 0.1.9.5 → 0.1.9.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/vue_crud/example_generator.rb +12 -0
  3. data/lib/generators/vue_crud/install_generator.rb +1 -1
  4. data/lib/generators/vue_crud/pace_generator.rb +11 -0
  5. data/lib/generators/vue_crud/semantic_generator.rb +12 -0
  6. data/lib/generators/vue_crud/templates/assets/images/semantic-ui/flags.png +0 -0
  7. data/lib/generators/vue_crud/templates/assets/javascripts/pace.min.js +1 -0
  8. data/lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/checkbox.js +831 -0
  9. data/lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/dimmer.js +708 -0
  10. data/lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/dropdown.js +3741 -0
  11. data/lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/modal.js +913 -0
  12. data/lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/site.js +487 -0
  13. data/lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/transition.js +1089 -0
  14. data/lib/generators/vue_crud/templates/assets/javascripts/vue.js +7402 -0
  15. data/lib/generators/vue_crud/templates/assets/stylesheets/pace.min.css +1 -0
  16. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/.DS_Store +0 -0
  17. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/.DS_Store +0 -0
  18. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_all.scss +7 -0
  19. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +124 -0
  20. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_form.scss +1706 -0
  21. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_grid.scss +84 -0
  22. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_grid_bk.scss +2032 -0
  23. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_menu.scss +2021 -0
  24. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_message.scss +482 -0
  25. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_mixins.scss +3 -0
  26. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_table.scss +1108 -0
  27. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/mixins/.DS_Store +0 -0
  28. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/mixins/_clearfix.scss +1 -0
  29. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/mixins/_grid-framework.scss +1 -0
  30. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/mixins/_grid.scss +1 -0
  31. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_all.scss +15 -0
  32. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_button.scss +3470 -0
  33. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_container.scss +148 -0
  34. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_divider.scss +262 -0
  35. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_flag.scss +1031 -0
  36. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_header.scss +721 -0
  37. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_icon.scss +3148 -0
  38. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_image.scss +306 -0
  39. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_input.scss +517 -0
  40. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_label.scss +1314 -0
  41. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_list.scss +951 -0
  42. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_loader.scss +349 -0
  43. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_rail.scss +152 -0
  44. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_reveal.scss +307 -0
  45. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_segment.scss +799 -0
  46. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_step.scss +646 -0
  47. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/globals/_all.scss +3 -0
  48. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/globals/_reset.scss +424 -0
  49. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/globals/_site.scss +163 -0
  50. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/globals/_variables.scss +32 -0
  51. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_accordion.scss +256 -0
  52. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_all.scss +17 -0
  53. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_checkbox.scss +627 -0
  54. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_dimmer.scss +199 -0
  55. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_dropdown.scss +1425 -0
  56. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_embed.scss +167 -0
  57. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_modal.scss +509 -0
  58. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_nag.scss +147 -0
  59. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_popup.scss +764 -0
  60. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_progress.scss +516 -0
  61. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_rating.scss +265 -0
  62. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_search.scss +409 -0
  63. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_shape.scss +157 -0
  64. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_sidebar.scss +644 -0
  65. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_sticky.scss +78 -0
  66. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_tab.scss +91 -0
  67. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_transition.scss +1981 -0
  68. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_video.scss +125 -0
  69. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_ad.scss +276 -0
  70. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_all.scss +6 -0
  71. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_card.scss +685 -0
  72. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_comment.scss +270 -0
  73. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_feed.scss +300 -0
  74. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_item.scss +481 -0
  75. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_statistic.scss +583 -0
  76. data/lib/generators/vue_crud/templates/example/user.rb +10 -0
  77. data/lib/generators/vue_crud/templates/example/users/index.html.erb +154 -0
  78. data/lib/generators/vue_crud/templates/example/users/index.json.jbuilder +15 -0
  79. data/lib/generators/vue_crud/templates/example/users/show.json.jbuilder +11 -0
  80. data/lib/generators/vue_crud/templates/example/users_controller.rb +85 -0
  81. data/lib/generators/vue_crud/vuejs_generator.rb +10 -0
  82. data/lib/vue_crud/version.rb +1 -1
  83. data/vendor/assets/javascripts/vue_crud.js +24 -3
  84. data/vendor/assets/stylesheets/vue_crud.css +0 -2
  85. metadata +80 -6
  86. data/vue_crud-0.1.5.gem +0 -0
  87. data/vue_crud-0.1.6.gem +0 -0
  88. data/vue_crud-0.1.7.gem +0 -0
  89. data/vue_crud-0.1.8.gem +0 -0
  90. data/vue_crud-0.1.9.gem +0 -0
@@ -0,0 +1,10 @@
1
+ class User < ApplicationRecord
2
+ has_one :profile, :dependent => :destroy
3
+ has_many :services, :dependent => :destroy
4
+ accepts_nested_attributes_for :profile, update_only: true
5
+ devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
6
+
7
+ def first_service
8
+ self.services.first if self.services.first.present?
9
+ end
10
+ end
@@ -0,0 +1,154 @@
1
+ <!-- NOTE: Custom Mixin and js -->
2
+ <script type="text/javascript">
3
+ var column_type = 'card'
4
+ var servicesComponent = Vue.component('services', {
5
+ template: '#services',
6
+ props: {
7
+ service: Object
8
+ },
9
+ data: function() {
10
+ return {
11
+ deleteMode: false,
12
+ }
13
+ },
14
+ methods: {
15
+ // TODO: add UpdateService method
16
+ deleteService: function() {
17
+ var that = this;
18
+ that.deleteMode = true;
19
+ if(confirm("Are you sure?") == true) {
20
+ $.ajax({
21
+ method: 'DELETE',
22
+ url: '/services/' + that.service.id + '.json',
23
+ success: function(res) {
24
+ $(that.$el).remove();
25
+ },
26
+ error: function(res) {
27
+ that.deleteMode = false;
28
+ }
29
+ })
30
+ }
31
+ }
32
+ }
33
+ })
34
+
35
+ var models_mixin = {
36
+ data: function() {
37
+ return {
38
+ service: {}
39
+ }
40
+ },
41
+ mounted: function() {
42
+
43
+ },
44
+ methods: {
45
+ createService: function () {
46
+ var that = this;
47
+ that.service.user_id = that.model.id
48
+ var modal = $('#editModal_' + that.model.id);
49
+ $.ajax({
50
+ method: 'POST',
51
+ data: {
52
+ service: that.service,
53
+ },
54
+ url: '/services.json',
55
+ before: function() {
56
+ $('.progress-bar').css('width', '0');
57
+ },
58
+ success: function(res) {
59
+ that.errors = {};
60
+ that.service = {};
61
+ that.model.services.push(res);
62
+ sleep(500).then(() => {
63
+ modal.modal('hide');
64
+ });
65
+ },
66
+ error: function(res) {
67
+ that.errors = res.responseJSON.errors;
68
+ }
69
+ });
70
+ },
71
+ addService: function() {
72
+ this.customMode = true;
73
+ }
74
+ }
75
+ }
76
+
77
+ var root_mixin = {
78
+ mounted: function() {
79
+ event_hub.$on('fetch_service_prototypes', function() {
80
+ this.fetchServicePrototypes();
81
+ }.bind(this));
82
+ },
83
+ methods: {
84
+ fetchServicePrototypes: function() {
85
+ $.ajax({
86
+ url: '/service_prototypes.json',
87
+ success: function(res) {
88
+ sleep(1000).then(() => {
89
+ event_hub.$emit('set_service_prototypes', res);
90
+ });
91
+ }
92
+ });
93
+ }
94
+ }
95
+ }
96
+ </script>
97
+
98
+ <!-- NOTE: Custom models -->
99
+ <script type="text/x-template" id="custom_models">
100
+ <div class="ui divider"></div>
101
+ <h3>Services</h3>
102
+ <div class="ui segments">
103
+ <services v-for="service in model.services" :service="service"></services>
104
+ </div>
105
+ </script>
106
+
107
+ <!-- NOTE: Custom action -->
108
+ <script type="text/x-template" id="custom_action">
109
+ <div class="ui animated fade green button" @click="addService" :data-modal="'#editModal_' + model.id" tabindex="0">
110
+ <div class="visible content">Add service</div>
111
+ <div class="hidden content">
112
+ <i class="right plus icon"></i>
113
+ </div>
114
+ </div>
115
+ </script>
116
+
117
+ <!-- NOTE: Custom modal body -->
118
+ <script type="text/x-template" id="custom_modal_body">
119
+ <form class="ui form">
120
+ <div class="field">
121
+ <label for="service_custom_name">Name</label>
122
+ <input type="text" id="service_name" v-model="service.name" required>
123
+ <div class="ui pointing red basic label" v-show="errors.name">
124
+ <span style="color:red" v-for="(error, index) in errors.name"><span v-if="index > 0">,</span> {{ error }}</span>
125
+ </div>
126
+ </div>
127
+ </form>
128
+ </script>
129
+
130
+ <!-- NOTE: Custom modal action -->
131
+ <script type="text/x-template" id="custom_modal_action">
132
+ <button @click="createService" class="ui blue button" v-show="customMode">Add service</button>
133
+ </script>
134
+
135
+ <!-- NOTE: Render vue_crud html file -->
136
+ <%= render :file => "#{Rails.root}/public/vue_crud" %>
137
+
138
+ <!-- NOTE: Custom template -->
139
+ <script type="text/x-template" id="services">
140
+ <div class="ui segment">
141
+ <div class="ui small feed">
142
+ <div class="event">
143
+ <div class="content">
144
+ <div class="summary">
145
+ Service name: <code>{{ service.name }}</code>
146
+ </div>
147
+ </div>
148
+ </div>
149
+ </div>
150
+ <div class="ui divider"></div>
151
+ <div class="ui blue button">Edit</div>
152
+ <div @click="deleteService" class="ui basic red right floated button" v-show="!deleteMode">Delete</div>
153
+ </div>
154
+ </script>
@@ -0,0 +1,15 @@
1
+ # Do not pass password and password_confirmation in json, because update action
2
+ json.array! @users do |user|
3
+ json.extract! user, :id, :email, :created_at, :updated_at, :first_service
4
+ if user.profile
5
+ json.profile_attributes do
6
+ json.extract! user.profile, :id, :company_name, :tel, :mobile, :fax, :address, :created_at, :updated_at
7
+ end
8
+ end
9
+
10
+ json.services do
11
+ json.array! user.services do |service|
12
+ json.extract! service, :id, :name, :description, :created_at, :updated_at
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ json.extract! @user, :id, :email, :created_at, :updated_at, :first_service
2
+ if @user.profile
3
+ json.profile_attributes do
4
+ json.extract! @user.profile, :id, :company_name, :tel, :mobile, :fax, :address, :created_at, :updated_at
5
+ end
6
+ end
7
+ json.services do
8
+ json.array! @user.services do |service|
9
+ json.extract! service, :id, :name, :description, :created_at, :updated_at
10
+ end
11
+ end
@@ -0,0 +1,85 @@
1
+ class UsersController < ApplicationController
2
+ before_action :set_user, only: [:update, :destroy]
3
+
4
+ def info
5
+ @info = {
6
+ :url_prefix => '/admin/users',
7
+ :titles => {
8
+ :display_name => 'user',
9
+ :title => 'User',
10
+ :subtitle => 'manage user',
11
+ :title_attribute_model_prefix => 'profile_attributes',
12
+ :title_attribute => 'company_name'
13
+ },
14
+ :structure => {:profile_attributes => {}, :service_ids => []},
15
+ :model_attributes => [
16
+ {:visible => true, :editable => false, :model_prefix => '', :name => 'first_service', :display_name => 'First services', :type => 'img', :input_class => '', :data_attribute => ''},
17
+ {:visible => true, :editable => false, :model_prefix => '', :name => 'id', :display_name => 'ID', :type => 'text', :input_class => '', :data_attribute => ''},
18
+ {:visible => true, :editable => true, :model_prefix => '', :name => 'email', :display_name => 'Email', :type => 'email', :input_class => '', :data_attribute => ''},
19
+ {:visible => false, :editable => true, :model_prefix => '', :name => 'password', :display_name => 'Password', :type => 'password', :input_class => '', :data_attribute => ''},
20
+ {:visible => false, :editable => true, :model_prefix => '', :name => 'password_confirmation', :display_name => 'Password confirmation', :type => 'password', :input_class => '', :data_attribute => ''},
21
+ {:visible => true, :editable => true, :model_prefix => 'profile_attributes', :name => 'company_name', :display_name => 'Company name', :type => 'text', :input_class => '', :data_attribute => ''},
22
+ {:visible => true, :editable => true, :model_prefix => 'profile_attributes', :name => 'tel', :display_name => 'Tel', :type => 'text', :input_class => '', :data_attribute => ''},
23
+ {:visible => true, :editable => true, :model_prefix => 'profile_attributes', :name => 'mobile', :display_name => 'Mobile', :type => 'text', :input_class => '', :data_attribute => ''},
24
+ {:visible => false, :editable => true, :model_prefix => 'profile_attributes', :name => 'fax', :display_name => 'Fax', :type => 'text', :input_class => '', :data_attribute => ''},
25
+ {:visible => false, :editable => true, :model_prefix => 'profile_attributes', :name => 'address', :display_name => 'Address', :type => 'text', :input_class => '', :data_attribute => ''},
26
+ ]
27
+ }
28
+ respond_to do |format|
29
+ format.json do
30
+ render :json => @info.to_json
31
+ end
32
+ end
33
+ end
34
+
35
+ def index
36
+ @users = User.includes(:profile).includes(:services).all
37
+ respond_to do |format|
38
+ format.html
39
+ format.json do
40
+ render 'index.json.jbuilder'
41
+ end
42
+ end
43
+ end
44
+
45
+ def create
46
+ @user = User.new(user_params)
47
+ respond_to do |format|
48
+ format.json do
49
+ if @user.save
50
+ render 'show.json.jbuilder'
51
+ else
52
+ render :json => { :errors => @user.errors.messages }, :status => 422
53
+ end
54
+ end
55
+ end
56
+ end
57
+
58
+ def update
59
+ respond_to do |format|
60
+ format.json do
61
+ if @user.update(user_params)
62
+ render :json => @user
63
+ else
64
+ render :json => { :errors => @user.errors.messages }, :status => 422
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+ def destroy
71
+ @user.destroy
72
+ respond_to do |format|
73
+ format.json { render :json => {}, :status => :no_content }
74
+ end
75
+ end
76
+
77
+ private
78
+ def set_user
79
+ @user = User.find(params[:id])
80
+ end
81
+
82
+ def user_params
83
+ params.require(:model).permit(:email, :password, :password_confirmation, :profile_attributes => [:company_name, :tel, :mobile, :fax, :address, :note])
84
+ end
85
+ end
@@ -0,0 +1,10 @@
1
+ require 'rails/generators'
2
+ module VueCrud
3
+ class VuejsGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../templates/assets", __FILE__)
5
+
6
+ def copy_template_file
7
+ copy_file "javascripts/vue.js", "app/assets/javascripts/vue.js"
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module VueCrud
2
- VERSION = "0.1.9.5"
2
+ VERSION = "0.1.9.6"
3
3
  end
@@ -1,5 +1,3 @@
1
- (function(){var t,e,n,r,s,o,i,u,a,c,l,p,h,g,f,d,m,y,v,w,b,k,S,q,L,x,T,R,P,E,j,M,A,N,O,_,F,C,U,W,X,I,D,H,z,B,G,J,Q,K=[].slice,V={}.hasOwnProperty,Y=function(t,e){function n(){this.constructor=t}for(var r in e)V.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},Z=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};for(b={catchupTime:100,initialRate:.03,minTime:250,ghostTime:100,maxProgressPerFrame:20,easeFactor:1.25,startOnPageLoad:!0,restartOnPushState:!0,restartOnRequestAfter:500,target:"body",elements:{checkInterval:100,selectors:["body"]},eventLag:{minSamples:10,sampleCount:3,lagThreshold:3},ajax:{trackMethods:["GET"],trackWebSockets:!0,ignoreURLs:[]}},P=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance.now():void 0)?t:+new Date},j=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,w=window.cancelAnimationFrame||window.mozCancelAnimationFrame,null==j&&(j=function(t){return setTimeout(t,50)},w=function(t){return clearTimeout(t)}),A=function(t){var e,n;return e=P(),(n=function(){var r;return r=P()-e,r>=33?(e=P(),t(r,function(){return j(n)})):setTimeout(n,33-r)})()},M=function(){var t,e,n;return n=arguments[0],e=arguments[1],t=3<=arguments.length?K.call(arguments,2):[],"function"==typeof n[e]?n[e].apply(n,t):n[e]},k=function(){var t,e,n,r,s,o,i;for(e=arguments[0],r=2<=arguments.length?K.call(arguments,1):[],o=0,i=r.length;i>o;o++)if(n=r[o])for(t in n)V.call(n,t)&&(s=n[t],null!=e[t]&&"object"==typeof e[t]&&null!=s&&"object"==typeof s?k(e[t],s):e[t]=s);return e},m=function(t){var e,n,r,s,o;for(n=e=0,s=0,o=t.length;o>s;s++)r=t[s],n+=Math.abs(r),e++;return n/e},q=function(t,e){var n,r,s;if(null==t&&(t="options"),null==e&&(e=!0),s=document.querySelector("[data-pace-"+t+"]")){if(n=s.getAttribute("data-pace-"+t),!e)return n;try{return JSON.parse(n)}catch(o){return r=o,"undefined"!=typeof console&&null!==console?console.error("Error parsing inline pace options",r):void 0}}},i=function(){function t(){}return t.prototype.on=function(t,e,n,r){var s;return null==r&&(r=!1),null==this.bindings&&(this.bindings={}),null==(s=this.bindings)[t]&&(s[t]=[]),this.bindings[t].push({handler:e,ctx:n,once:r})},t.prototype.once=function(t,e,n){return this.on(t,e,n,!0)},t.prototype.off=function(t,e){var n,r,s;if(null!=(null!=(r=this.bindings)?r[t]:void 0)){if(null==e)return delete this.bindings[t];for(n=0,s=[];n<this.bindings[t].length;)s.push(this.bindings[t][n].handler===e?this.bindings[t].splice(n,1):n++);return s}},t.prototype.trigger=function(){var t,e,n,r,s,o,i,u,a;if(n=arguments[0],t=2<=arguments.length?K.call(arguments,1):[],null!=(i=this.bindings)?i[n]:void 0){for(s=0,a=[];s<this.bindings[n].length;)u=this.bindings[n][s],r=u.handler,e=u.ctx,o=u.once,r.apply(null!=e?e:this,t),a.push(o?this.bindings[n].splice(s,1):s++);return a}},t}(),c=window.Pace||{},window.Pace=c,k(c,i.prototype),E=c.options=k({},b,window.paceOptions,q()),G=["ajax","document","eventLag","elements"],D=0,z=G.length;z>D;D++)F=G[D],E[F]===!0&&(E[F]=b[F]);a=function(t){function e(){return J=e.__super__.constructor.apply(this,arguments)}return Y(e,t),e}(Error),e=function(){function t(){this.progress=0}return t.prototype.getElement=function(){var t;if(null==this.el){if(t=document.querySelector(E.target),!t)throw new a;this.el=document.createElement("div"),this.el.className="pace pace-active",document.body.className=document.body.className.replace(/pace-done/g,""),document.body.className+=" pace-running",this.el.innerHTML='<div class="pace-progress">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>',null!=t.firstChild?t.insertBefore(this.el,t.firstChild):t.appendChild(this.el)}return this.el},t.prototype.finish=function(){var t;return t=this.getElement(),t.className=t.className.replace("pace-active",""),t.className+=" pace-inactive",document.body.className=document.body.className.replace("pace-running",""),document.body.className+=" pace-done"},t.prototype.update=function(t){return this.progress=t,this.render()},t.prototype.destroy=function(){try{this.getElement().parentNode.removeChild(this.getElement())}catch(t){a=t}return this.el=void 0},t.prototype.render=function(){var t,e,n,r,s,o,i;if(null==document.querySelector(E.target))return!1;for(t=this.getElement(),r="translate3d("+this.progress+"%, 0, 0)",i=["webkitTransform","msTransform","transform"],s=0,o=i.length;o>s;s++)e=i[s],t.children[0].style[e]=r;var u=document.getElementById("form-progress");return"undefined"!=typeof u&&null!=u&&(u.value=0|this.progress,jQuery(u).change()),(!this.lastRenderedProgress||this.lastRenderedProgress|0!==this.progress|0)&&(t.children[0].setAttribute("data-progress-text",""+(0|this.progress)+"%"),this.progress>=100?n="99":(n=this.progress<10?"0":"",n+=0|this.progress),t.children[0].setAttribute("data-progress",""+n)),this.lastRenderedProgress=this.progress},t.prototype.done=function(){return this.progress>=100},t}(),u=function(){function t(){this.bindings={}}return t.prototype.trigger=function(t,e){var n,r,s,o,i;if(null!=this.bindings[t]){for(o=this.bindings[t],i=[],r=0,s=o.length;s>r;r++)n=o[r],i.push(n.call(this,e));return i}},t.prototype.on=function(t,e){var n;return null==(n=this.bindings)[t]&&(n[t]=[]),this.bindings[t].push(e)},t}(),I=window.XMLHttpRequest,X=window.XDomainRequest,W=window.WebSocket,S=function(t,e){var n,r,s,o;o=[];for(r in e.prototype)try{s=e.prototype[r],o.push(null==t[r]&&"function"!=typeof s?t[r]=s:void 0)}catch(i){n=i}return o},T=[],c.ignore=function(){var t,e,n;return e=arguments[0],t=2<=arguments.length?K.call(arguments,1):[],T.unshift("ignore"),n=e.apply(null,t),T.shift(),n},c.track=function(){var t,e,n;return e=arguments[0],t=2<=arguments.length?K.call(arguments,1):[],T.unshift("track"),n=e.apply(null,t),T.shift(),n},_=function(t){var e;if(null==t&&(t="GET"),"track"===T[0])return"force";if(!T.length&&E.ajax){if("socket"===t&&E.ajax.trackWebSockets)return!0;if(e=t.toUpperCase(),Z.call(E.ajax.trackMethods,e)>=0)return!0}return!1},l=function(t){function e(){var t,n=this;e.__super__.constructor.apply(this,arguments),t=function(t){var e;return e=t.open,t.open=function(r,s){return _(r)&&n.trigger("request",{type:r,url:s,request:t}),e.apply(t,arguments)}},window.XMLHttpRequest=function(e){var n;return n=new I(e),t(n),n};try{S(window.XMLHttpRequest,I)}catch(r){}if(null!=X){window.XDomainRequest=function(){var e;return e=new X,t(e),e};try{S(window.XDomainRequest,X)}catch(r){}}if(null!=W&&E.ajax.trackWebSockets){window.WebSocket=function(t,e){var r;return r=null!=e?new W(t,e):new W(t),_("socket")&&n.trigger("request",{type:"socket",url:t,protocols:e,request:r}),r};try{S(window.WebSocket,W)}catch(r){}}}return Y(e,t),e}(u),H=null,L=function(){return null==H&&(H=new l),H},O=function(t){var e,n,r,s;for(s=E.ajax.ignoreURLs,n=0,r=s.length;r>n;n++)if(e=s[n],"string"==typeof e){if(-1!==t.indexOf(e))return!0}else if(e.test(t))return!0;return!1},L().on("request",function(e){var n,r,s,o,i;return o=e.type,s=e.request,i=e.url,O(i)?void 0:c.running||E.restartOnRequestAfter===!1&&"force"!==_(o)?void 0:(r=arguments,n=E.restartOnRequestAfter||0,"boolean"==typeof n&&(n=0),setTimeout(function(){var e,n,i,u,a,l;if(e="socket"===o?s.readyState<2:0<(u=s.readyState)&&4>u){for(c.restart(),a=c.sources,l=[],n=0,i=a.length;i>n;n++){if(F=a[n],F instanceof t){F.watch.apply(F,r);break}l.push(void 0)}return l}},n))}),t=function(){function t(){var t=this;this.elements=[],L().on("request",function(){return t.watch.apply(t,arguments)})}return t.prototype.watch=function(t){var e,n,r,s;return r=t.type,e=t.request,s=t.url,O(s)?void 0:(n="socket"===r?new g(e):new f(e),this.elements.push(n))},t}(),f=function(){function t(t){var e,n,r,s,o,i,u=this;if(this.progress=0,null!=window.ProgressEvent)for(n=null,t.addEventListener("progress",function(t){return u.progress=t.lengthComputable?100*t.loaded/t.total:u.progress+(100-u.progress)/2},!1),i=["load","abort","timeout","error"],r=0,s=i.length;s>r;r++)e=i[r],t.addEventListener(e,function(){return u.progress=100},!1);else o=t.onreadystatechange,t.onreadystatechange=function(){var e;return 0===(e=t.readyState)||4===e?u.progress=100:3===t.readyState&&(u.progress=50),"function"==typeof o?o.apply(null,arguments):void 0}}return t}(),g=function(){function t(t){var e,n,r,s,o=this;for(this.progress=0,s=["error","open"],n=0,r=s.length;r>n;n++)e=s[n],t.addEventListener(e,function(){return o.progress=100},!1)}return t}(),r=function(){function t(t){var e,n,r,o;for(null==t&&(t={}),this.elements=[],null==t.selectors&&(t.selectors=[]),o=t.selectors,n=0,r=o.length;r>n;n++)e=o[n],this.elements.push(new s(e))}return t}(),s=function(){function t(t){this.selector=t,this.progress=0,this.check()}return t.prototype.check=function(){var t=this;return document.querySelector(this.selector)?this.done():setTimeout(function(){return t.check()},E.elements.checkInterval)},t.prototype.done=function(){return this.progress=100},t}(),n=function(){function t(){var t,e,n=this;this.progress=null!=(e=this.states[document.readyState])?e:100,t=document.onreadystatechange,document.onreadystatechange=function(){return null!=n.states[document.readyState]&&(n.progress=n.states[document.readyState]),"function"==typeof t?t.apply(null,arguments):void 0}}return t.prototype.states={loading:0,interactive:50,complete:100},t}(),o=function(){function t(){var t,e,n,r,s,o=this;this.progress=0,t=0,s=[],r=0,n=P(),e=setInterval(function(){var i;return i=P()-n-50,n=P(),s.push(i),s.length>E.eventLag.sampleCount&&s.shift(),t=m(s),++r>=E.eventLag.minSamples&&t<E.eventLag.lagThreshold?(o.progress=100,clearInterval(e)):o.progress=100*(3/(t+3))},50)}return t}(),h=function(){function t(t){this.source=t,this.last=this.sinceLastUpdate=0,this.rate=E.initialRate,this.catchup=0,this.progress=this.lastProgress=0,null!=this.source&&(this.progress=M(this.source,"progress"))}return t.prototype.tick=function(t,e){var n;return null==e&&(e=M(this.source,"progress")),e>=100&&(this.done=!0),e===this.last?this.sinceLastUpdate+=t:(this.sinceLastUpdate&&(this.rate=(e-this.last)/this.sinceLastUpdate),this.catchup=(e-this.progress)/E.catchupTime,this.sinceLastUpdate=0,this.last=e),e>this.progress&&(this.progress+=this.catchup*t),n=1-Math.pow(this.progress/100,E.easeFactor),this.progress+=n*this.rate*t,this.progress=Math.min(this.lastProgress+E.maxProgressPerFrame,this.progress),this.progress=Math.max(0,this.progress),this.progress=Math.min(100,this.progress),this.lastProgress=this.progress,this.progress},t}(),C=null,N=null,y=null,U=null,d=null,v=null,c.running=!1,x=function(){return E.restartOnPushState?c.restart():void 0},null!=window.history.pushState&&(B=window.history.pushState,window.history.pushState=function(){return x(),B.apply(window.history,arguments)}),null!=window.history.replaceState&&(Q=window.history.replaceState,window.history.replaceState=function(){return x(),Q.apply(window.history,arguments)}),p={ajax:t,elements:r,document:n,eventLag:o},(R=function(){var t,n,r,s,o,i,u,a;for(c.sources=C=[],i=["ajax","elements","document","eventLag"],n=0,s=i.length;s>n;n++)t=i[n],E[t]!==!1&&C.push(new p[t](E[t]));for(a=null!=(u=E.extraSources)?u:[],r=0,o=a.length;o>r;r++)F=a[r],C.push(new F(E));return c.bar=y=new e,N=[],U=new h})(),c.stop=function(){return c.trigger("stop"),c.running=!1,y.destroy(),v=!0,null!=d&&("function"==typeof w&&w(d),d=null),R()},c.restart=function(){return c.trigger("restart"),c.stop(),c.start()},c.go=function(){var t;return c.running=!0,y.render(),t=P(),v=!1,d=A(function(e,n){var r,s,o,i,u,a,l,p,g,f,d,m,w,b,k,S;for(p=100-y.progress,s=d=0,o=!0,a=m=0,b=C.length;b>m;a=++m)for(F=C[a],f=null!=N[a]?N[a]:N[a]=[],u=null!=(S=F.elements)?S:[F],l=w=0,k=u.length;k>w;l=++w)i=u[l],g=null!=f[l]?f[l]:f[l]=new h(i),o&=g.done,g.done||(s++,d+=g.tick(e));return r=d/s,y.update(U.tick(e,r)),y.done()||o||v?(y.update(100),c.trigger("done"),setTimeout(function(){return y.finish(),c.running=!1,c.trigger("hide")},Math.max(E.ghostTime,Math.max(E.minTime-(P()-t),0)))):n()})},c.start=function(t){k(E,t),c.running=!0;try{y.render()}catch(e){a=e}return document.querySelector(".pace")?(c.trigger("start"),c.go()):setTimeout(c.start,50)},"function"==typeof define&&define.amd?define(function(){return c}):"object"==typeof exports?module.exports=c:E.startOnPageLoad&&c.start()}).call(this);
2
-
3
1
  $(document).ajaxStart(function() { Pace.restart(); });
4
2
  Vue.config.devtools = true;
5
3
  Pace.on('done', function() {
@@ -14,6 +12,23 @@ function obj_to_json(obj) {
14
12
  }
15
13
  var models_mixin = {}
16
14
  var root_mixin = {}
15
+ function removeParam(key, sourceURL) {
16
+ var rtn = sourceURL.split("?")[0],
17
+ param,
18
+ params_arr = [],
19
+ queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
20
+ if (queryString !== "") {
21
+ params_arr = queryString.split("&");
22
+ for (var i = params_arr.length - 1; i >= 0; i -= 1) {
23
+ param = params_arr[i].split("=")[0];
24
+ if (param === key) {
25
+ params_arr.splice(i, 1);
26
+ }
27
+ }
28
+ rtn = rtn + "?" + params_arr.join("&");
29
+ }
30
+ return rtn;
31
+ }
17
32
  function updateQueryStringParam(key, value) {
18
33
  baseUrl = [location.protocol, '//', location.host, location.pathname].join('');
19
34
  urlQueryString = document.location.search;
@@ -178,7 +193,13 @@ function vue_init(params = {}) {
178
193
  success: function(res) {
179
194
  that.info = res;
180
195
  that.model = obj_to_json(that.info.structure);
181
- that.default_url = that.info.url_prefix + location.search;
196
+ var default_url = that.info.url_prefix + location.search;
197
+ default_url = removeParam("p", default_url);
198
+ default_url = removeParam("q", default_url);
199
+ default_url = removeParam("mp", default_url);
200
+ default_url = removeParam("sa", default_url);
201
+ default_url = removeParam("st", default_url);
202
+ that.default_url = default_url;
182
203
  $.ajax({
183
204
  url: that.info.url_prefix + options.suffix + location.search,
184
205
  success: function(res) {
@@ -1,5 +1,3 @@
1
- .pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.pace-inactive{display:none}.pace .pace-progress{background:#29d;position:fixed;z-index:2000;top:0;right:100%;width:100%;height:2px}
2
-
3
1
  #vue_crud .ui.cards > .card > .extra a.save_now {
4
2
  color: rgb(33, 133, 208);
5
3
  opacity: 1;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vue_crud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9.5
4
+ version: 0.1.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donald Chiang
@@ -69,8 +69,87 @@ files:
69
69
  - bin/setup
70
70
  - lib/.DS_Store
71
71
  - lib/generators/.DS_Store
72
+ - lib/generators/vue_crud/example_generator.rb
72
73
  - lib/generators/vue_crud/install_generator.rb
74
+ - lib/generators/vue_crud/pace_generator.rb
75
+ - lib/generators/vue_crud/semantic_generator.rb
76
+ - lib/generators/vue_crud/templates/assets/images/semantic-ui/flags.png
77
+ - lib/generators/vue_crud/templates/assets/javascripts/pace.min.js
78
+ - lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/checkbox.js
79
+ - lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/dimmer.js
80
+ - lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/dropdown.js
81
+ - lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/modal.js
82
+ - lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/site.js
83
+ - lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/transition.js
84
+ - lib/generators/vue_crud/templates/assets/javascripts/vue.js
85
+ - lib/generators/vue_crud/templates/assets/stylesheets/pace.min.css
86
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/.DS_Store
87
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/.DS_Store
88
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_all.scss
89
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss
90
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_form.scss
91
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_grid.scss
92
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_grid_bk.scss
93
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_menu.scss
94
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_message.scss
95
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_mixins.scss
96
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_table.scss
97
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/mixins/.DS_Store
98
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/mixins/_clearfix.scss
99
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/mixins/_grid-framework.scss
100
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/mixins/_grid.scss
101
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_all.scss
102
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_button.scss
103
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_container.scss
104
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_divider.scss
105
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_flag.scss
106
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_header.scss
107
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_icon.scss
108
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_image.scss
109
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_input.scss
110
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_label.scss
111
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_list.scss
112
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_loader.scss
113
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_rail.scss
114
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_reveal.scss
115
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_segment.scss
116
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_step.scss
117
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/globals/_all.scss
118
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/globals/_reset.scss
119
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/globals/_site.scss
120
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/globals/_variables.scss
121
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_accordion.scss
122
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_all.scss
123
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_checkbox.scss
124
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_dimmer.scss
125
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_dropdown.scss
126
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_embed.scss
127
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_modal.scss
128
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_nag.scss
129
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_popup.scss
130
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_progress.scss
131
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_rating.scss
132
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_search.scss
133
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_shape.scss
134
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_sidebar.scss
135
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_sticky.scss
136
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_tab.scss
137
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_transition.scss
138
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_video.scss
139
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_ad.scss
140
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_all.scss
141
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_card.scss
142
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_comment.scss
143
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_feed.scss
144
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_item.scss
145
+ - lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_statistic.scss
146
+ - lib/generators/vue_crud/templates/example/user.rb
147
+ - lib/generators/vue_crud/templates/example/users/index.html.erb
148
+ - lib/generators/vue_crud/templates/example/users/index.json.jbuilder
149
+ - lib/generators/vue_crud/templates/example/users/show.json.jbuilder
150
+ - lib/generators/vue_crud/templates/example/users_controller.rb
73
151
  - lib/generators/vue_crud/templates/vue_crud.html
152
+ - lib/generators/vue_crud/vuejs_generator.rb
74
153
  - lib/vue_crud.rb
75
154
  - lib/vue_crud/engine.rb
76
155
  - lib/vue_crud/version.rb
@@ -78,11 +157,6 @@ files:
78
157
  - vendor/assets/.DS_Store
79
158
  - vendor/assets/javascripts/vue_crud.js
80
159
  - vendor/assets/stylesheets/vue_crud.css
81
- - vue_crud-0.1.5.gem
82
- - vue_crud-0.1.6.gem
83
- - vue_crud-0.1.7.gem
84
- - vue_crud-0.1.8.gem
85
- - vue_crud-0.1.9.gem
86
160
  - vue_crud.gemspec
87
161
  homepage: http://www.mynet.com.tw
88
162
  licenses: