wordjelly-auth 1.2.2 → 1.2.3

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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/payumoney.png +0 -0
  3. data/app/assets/javascripts/auth/auth_dependencies.js +20 -1
  4. data/app/assets/stylesheets/auth/common-styles.scss +15 -0
  5. data/app/controllers/auth/concerns/shopping/cart_controller_concern.rb +2 -2
  6. data/app/controllers/auth/concerns/shopping/cart_item_controller_concern.rb +24 -0
  7. data/app/controllers/auth/concerns/shopping/discount_controller_concern.rb +2 -2
  8. data/app/controllers/auth/concerns/shopping/payment_controller_concern.rb +5 -2
  9. data/app/controllers/auth/concerns/shopping/personality_controller_concern.rb +88 -0
  10. data/app/controllers/auth/concerns/shopping/place_controller_concern.rb +96 -0
  11. data/app/controllers/auth/concerns/shopping/product_controller_concern.rb +53 -42
  12. data/app/controllers/auth/concerns/token_concern.rb +3 -1
  13. data/app/controllers/auth/search_controller.rb +3 -3
  14. data/app/controllers/auth/shopping/personalities_controller.rb +14 -0
  15. data/app/controllers/auth/shopping/places_controller.rb +11 -0
  16. data/app/controllers/auth/shopping/shopping_controller.rb +26 -0
  17. data/app/helpers/auth/shopping/payments/pay_u_money_helper.rb +1 -1
  18. data/app/helpers/auth/shopping/personalities/personalities_helper.rb +26 -0
  19. data/app/helpers/auth/shopping/places/places_helper.rb +26 -0
  20. data/app/helpers/auth/shopping/products/products_helper.rb +2 -2
  21. data/app/models/auth/concerns/chief_model_concern.rb +0 -4
  22. data/app/models/auth/concerns/shopping/cart_concern.rb +31 -4
  23. data/app/models/auth/concerns/shopping/cart_item_concern.rb +4 -7
  24. data/app/models/auth/concerns/shopping/discount_concern.rb +0 -7
  25. data/app/models/auth/concerns/shopping/pay_u_money_concern.rb +2 -2
  26. data/app/models/auth/concerns/shopping/payment_concern.rb +25 -8
  27. data/app/models/auth/concerns/shopping/personality_concern.rb +91 -0
  28. data/app/models/auth/concerns/shopping/place_concern.rb +134 -0
  29. data/app/models/auth/concerns/shopping/product_concern.rb +57 -1
  30. data/app/models/auth/shopping/personality.rb +3 -0
  31. data/app/models/auth/shopping/place.rb +3 -0
  32. data/app/views/auth/search/authenticated_user_search.js.erb +5 -31
  33. data/app/views/auth/shopping/personalities/_form.html.erb +32 -0
  34. data/app/views/auth/shopping/personalities/_search.html.erb +6 -0
  35. data/app/views/auth/shopping/personalities/_search_results_holder.html.erb +3 -0
  36. data/app/views/auth/shopping/personalities/new.html.erb +1 -0
  37. data/app/views/auth/shopping/places/_form.html.erb +62 -0
  38. data/app/views/auth/shopping/places/_search.html.erb +6 -0
  39. data/app/views/auth/shopping/places/_search_results_holder.html.erb +3 -0
  40. data/app/views/auth/shopping/places/new.html.erb +1 -0
  41. data/app/views/auth/shopping/products/index/_show.html.erb +1 -1
  42. data/app/views/auth/shopping/products/show/_content.html.erb +2 -1
  43. data/lib/assets/javascripts/search.js +0 -2
  44. data/lib/auth/engine.rb +15 -0
  45. data/lib/auth/rails/routes.rb +7 -1
  46. data/lib/auth/search/main.rb +20 -8
  47. data/lib/auth/version.rb +1 -1
  48. data/lib/wordjelly-auth.rb +1 -0
  49. data/spec/dummy/app/assets/time_hashes.json +1 -1
  50. data/spec/dummy/config/initializers/preinitializer.rb +8 -1
  51. data/spec/dummy/config/routes.rb +1 -1
  52. metadata +37 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20bc9b5081d66477ee0989ac143f8a60f478ce80
4
- data.tar.gz: 26ec2c00029ee39d59fdc93fc13e5282a254b27b
3
+ metadata.gz: 175b71c3a18b1cf69cde6e8c515ff85898bf853f
4
+ data.tar.gz: 02a26067e6f60b5111dc96fec8b1e11a8c3b7f10
5
5
  SHA512:
6
- metadata.gz: 1a7120152153b13ef4f10b7b4db6fc518877aa21ab8614c2b70f578d59e2a90da204e822a6ceb73782fef3bd6c2d2752a3e3b9bfbc271504bdf4d8443f2c653f
7
- data.tar.gz: adbc0907a82f757b9b4cc225ab4789a40a2f9090b37d49684c15ad37a03a067780758055d551b71e73600d578b3555a7f22bc9423e5e9c50ec653665006f2d0e
6
+ metadata.gz: e55de5b86cd70fcbe9829f572c356c4c9882b3aec5d7e541146b509bc588734cae0c08e7f360aecec60f2a2d8d9eb3f71c62deb1012ddbc86ef485efdccbbc8f
7
+ data.tar.gz: ce2da498b71b26c56365794980b3fa2441181873a1b4c8203d509261b3b92f4d199700c2b280ad81d7dc0bad27c42b04a28d4b2edfe6734a84041186ad6e5de7
Binary file
@@ -14,6 +14,21 @@ $(document).ready(function() {
14
14
  });
15
15
  ***/
16
16
 
17
+ document.addEventListener("turbolinks:load", function() {
18
+ $('.modal').modal();
19
+ $('.tabs').tabs();
20
+ $('.sidenav').sidenav();
21
+ $('.collapsible').collapsible();
22
+ $('.parallax').parallax();
23
+ $('.datepicker').datepicker();
24
+ $('select').formSelect();
25
+ });
26
+
27
+
28
+ $(document).ready(function(){
29
+ $('select').formSelect();
30
+ });
31
+
17
32
  $(document).ready(function(){
18
33
  $('.modal').modal();
19
34
  });
@@ -32,4 +47,8 @@ $(document).ready(function(){
32
47
 
33
48
  $(document).ready(function(){
34
49
  $('.parallax').parallax();
35
- });
50
+ });
51
+
52
+ $(document).ready(function(){
53
+ $('.datepicker').datepicker();
54
+ });
@@ -83,10 +83,25 @@
83
83
  font-size:23px !important;
84
84
  }
85
85
 
86
+ .fs-24{
87
+ font-size:24px !important;
88
+ }
89
+
86
90
  .fs-25{
87
91
  font-size:25px !important;
88
92
  }
89
93
 
94
+ .fs-26{
95
+ font-size:26px !important;
96
+ }
97
+
98
+ .fs-27{
99
+ font-size:27px !important;
100
+ }
101
+
102
+ .fs-28{
103
+ font-size:28px !important;
104
+ }
90
105
 
91
106
  .fs-30{
92
107
  font-size:30px !important;
@@ -99,7 +99,7 @@ module Auth::Concerns::Shopping::CartControllerConcern
99
99
 
100
100
  ##override this def in your controller, and add attributes to transaction:[], each of the attributes in the transaction key will be cycled through, and if those fields exist on the cart_item, then they will be set.
101
101
  def permitted_params
102
- params.permit({cart: [:discount_id,:name, :notes, {:add_cart_item_ids => []},{:remove_cart_item_ids => []}]},:id)
102
+ params.permit({cart: [:personality_id, :place_id, :discount_id,:name, :notes, {:add_cart_item_ids => []},{:remove_cart_item_ids => []}]},:id)
103
103
  end
104
104
 
105
- end
105
+ end
@@ -7,6 +7,7 @@ module Auth::Concerns::Shopping::CartItemControllerConcern
7
7
  ## to be able to initialize a cart item from a product
8
8
  ## inside the create_multiple def.
9
9
  include Auth::Shopping::Products::ProductsHelper
10
+ include Auth::Shopping::CartItems::CartItemsHelper
10
11
 
11
12
  end
12
13
 
@@ -88,6 +89,29 @@ module Auth::Concerns::Shopping::CartItemControllerConcern
88
89
  ##
89
90
  ##
90
91
  ############################################################
92
+ ## need to add this to the route.
93
+ ## and need to provide a link to this, and that's the end of this part.
94
+ def create_package_items
95
+ cart_items = []
96
+ params[:product_ids].each do |product_id|
97
+ cart_item = Auth.configuration.cart_item_class.constantize.new(product_id: product_id)
98
+ cart_item.resource_id = lookup_resource.id.to_s
99
+ cart_item.resource_class = lookup_resource.class.name.to_s
100
+ cart_item.signed_in_resource = current_signed_in_resource
101
+ cart_item.save
102
+ cart_items << cart_item
103
+ end
104
+ respond_to do |format|
105
+ format.html do
106
+ redirect_to cart_items_path
107
+ end
108
+ format.json do
109
+ render :json => cart_items.to_json
110
+ end
111
+ end
112
+ end
113
+
114
+
91
115
  def create_multiple
92
116
  #puts "came to create multiple."
93
117
  #puts "params are:"
@@ -37,7 +37,7 @@ module Auth::Concerns::Shopping::DiscountControllerConcern
37
37
  respond_with @auth_shopping_discount
38
38
  end
39
39
 
40
- ##only permits the quantity to be changed, transaction id is internally assigned and can never be changed by the external world.
40
+
41
41
  def update
42
42
 
43
43
  check_for_update(@auth_shopping_discount)
@@ -45,8 +45,8 @@ module Auth::Concerns::Shopping::DiscountControllerConcern
45
45
  @auth_shopping_discount.assign_attributes(@auth_shopping_discount_params)
46
46
  @auth_shopping_discount = add_owner_and_signed_in_resource(@auth_shopping_discount)
47
47
 
48
-
49
48
  @auth_shopping_discount.save
49
+
50
50
  respond_with @auth_shopping_discount
51
51
  end
52
52
 
@@ -16,6 +16,7 @@ module Auth::Concerns::Shopping::PaymentControllerConcern
16
16
 
17
17
  def show
18
18
  @auth_shopping_payment = add_signed_in_resource(@auth_shopping_payment)
19
+
19
20
  @auth_shopping_payment.set_payment_receipt
20
21
  respond_with @auth_shopping_payment
21
22
  end
@@ -27,8 +28,10 @@ module Auth::Concerns::Shopping::PaymentControllerConcern
27
28
  end
28
29
 
29
30
  def new
31
+ puts "these are payment attributes"
32
+ puts @auth_shopping_payment.attributes.to_s
30
33
  @auth_shopping_payment = add_owner_and_signed_in_resource(@auth_shopping_payment)
31
- ## so simply render the new action anyways.
34
+ @auth_shopping_payment.set_cart(@auth_shopping_payment.cart_id)
32
35
  end
33
36
 
34
37
  def edit
@@ -68,7 +71,7 @@ module Auth::Concerns::Shopping::PaymentControllerConcern
68
71
  #puts "these are the attributes assigned in the update action."
69
72
  #puts @auth_shopping_payment.attributes.to_s
70
73
  @auth_shopping_payment.payment_params = params
71
- #puts "assigned params."
74
+
72
75
  save_response = @auth_shopping_payment.save
73
76
 
74
77
  ## if save successfull then otherwise, respond_with edit.
@@ -0,0 +1,88 @@
1
+ module Auth::Concerns::Shopping::PersonalityControllerConcern
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ include Auth::Shopping::Personalities::PersonalitiesHelper
7
+ end
8
+
9
+ ##if an id is provided in the permitted params then tries to find that in the database, and makes a new cart item out of it.
10
+ #if no id is provided then creates a new personality from the permitted params, but excluding the id key.
11
+ #if a collection i.e plural resources is present in the permitted_params and its also there in our auth resources, then create a resource class and resource symbol out of it and assign resource as in the comments.
12
+ def initialize_vars
13
+ instantiate_shopping_classes
14
+
15
+ @auth_shopping_personality_params = permitted_params.fetch(:personality,{})
16
+ @auth_shopping_personality = params[:id] ? @auth_shopping_personality_class.find_self(params[:id],current_signed_in_resource) : @auth_shopping_personality_class.new(@auth_shopping_personality_params)
17
+
18
+ end
19
+
20
+
21
+ ##expects the product id, resource_id is the logged in resource, and quantity
22
+ def create
23
+ ##ensure that the cart item is new
24
+
25
+ check_for_create(@auth_shopping_personality)
26
+ @auth_shopping_personality = add_owner_and_signed_in_resource(@auth_shopping_personality)
27
+
28
+ @auth_shopping_personality.save
29
+
30
+ respond_with @auth_shopping_personality
31
+ end
32
+
33
+ ##only permits the quantity to be changed, transaction id is internally assigned and can never be changed by the external world.
34
+ def update
35
+ check_for_update(@auth_shopping_personality)
36
+ @auth_shopping_personality.assign_attributes(@auth_shopping_personality_params)
37
+ @auth_shopping_personality = add_owner_and_signed_in_resource(@auth_shopping_personality)
38
+ @auth_shopping_personality.save
39
+ puts @auth_shopping_personality.errors.full_messages.to_s
40
+ respond_with @auth_shopping_personality
41
+ end
42
+
43
+ def show
44
+ not_found if @auth_shopping_personality.nil?
45
+ respond_with @auth_shopping_personality
46
+ end
47
+
48
+ ##should show those cart items which do not have a parent_id.
49
+ ##since these are the pending cart items.
50
+ ##all remaining cart items have already been assigned to carts
51
+ def index
52
+ @auth_shopping_personalities = @auth_shopping_personality_class.find_personalities({:resource => lookup_resource}).page 1
53
+ respond_with @auth_shopping_personalities
54
+ end
55
+
56
+
57
+ ##can be removed.
58
+ ##responds with 204, and empty response body, if all is ok.
59
+ def destroy
60
+ not_found if @auth_shopping_personality.nil?
61
+ @auth_shopping_personality.destroy
62
+ respond_with @auth_shopping_personality
63
+ end
64
+
65
+ def search
66
+ args = {:query_string => params[:query_string]}
67
+ query_clause = Auth::Search::Main.es_six_finalize_search_query_clause(args)
68
+ @search_results = Auth.configuration.personality_class.constantize.es.search(query_clause,{:wrapper => :load}).results
69
+ respond_to do |format|
70
+ ## with js.
71
+ format.js do
72
+ render :partial => "search_result", locals: {search_results: @search_results, suggestions: []}
73
+ end
74
+ format.json do
75
+ render json: @search_results.to_json
76
+ end
77
+ end
78
+ end
79
+
80
+
81
+ ## this permitted params is overridden in the dummy app, and as a result throws unpermitted parameters for the daughter app parameters, even though they are subsequently permitted, since super is called first.
82
+ def permitted_params
83
+
84
+ params.permit({personality: [:date_of_birth, :fullname, :sex]},:id, :query_string)
85
+
86
+ end
87
+
88
+ end
@@ -0,0 +1,96 @@
1
+ module Auth::Concerns::Shopping::PlaceControllerConcern
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+
7
+ ## to be able to initialize a cart item from a product
8
+ ## inside the create_multiple def.
9
+ include Auth::Shopping::Places::PlacesHelper
10
+
11
+ end
12
+
13
+
14
+
15
+ ##if an id is provided in the permitted params then tries to find that in the database, and makes a new cart item out of it.
16
+ #if no id is provided then creates a new place from the permitted params, but excluding the id key.
17
+ #if a collection i.e plural resources is present in the permitted_params and its also there in our auth resources, then create a resource class and resource symbol out of it and assign resource as in the comments.
18
+ def initialize_vars
19
+ instantiate_shopping_classes
20
+
21
+
22
+ @auth_shopping_place_params = permitted_params.fetch(:place,{})
23
+ @auth_shopping_place = params[:id] ? @auth_shopping_place_class.find_self(params[:id],current_signed_in_resource) : @auth_shopping_place_class.new(@auth_shopping_place_params)
24
+
25
+ end
26
+
27
+
28
+ ##expects the product id, resource_id is the logged in resource, and quantity
29
+ def create
30
+ ##ensure that the cart item is new
31
+
32
+ check_for_create(@auth_shopping_place)
33
+ @auth_shopping_place = add_owner_and_signed_in_resource(@auth_shopping_place)
34
+
35
+ @auth_shopping_place.save
36
+
37
+ respond_with @auth_shopping_place
38
+ end
39
+
40
+ ##only permits the quantity to be changed, transaction id is internally assigned and can never be changed by the external world.
41
+ def update
42
+ check_for_update(@auth_shopping_place)
43
+ @auth_shopping_place.assign_attributes(@auth_shopping_place_params)
44
+ @auth_shopping_place = add_owner_and_signed_in_resource(@auth_shopping_place)
45
+ @auth_shopping_place.save
46
+ puts @auth_shopping_place.errors.full_messages.to_s
47
+ respond_with @auth_shopping_place
48
+ end
49
+
50
+ def show
51
+ not_found if @auth_shopping_place.nil?
52
+ respond_with @auth_shopping_place
53
+ end
54
+
55
+ ##should show those cart items which do not have a parent_id.
56
+ ##since these are the pending cart items.
57
+ ##all remaining cart items have already been assigned to carts
58
+ def index
59
+ @auth_shopping_places = @auth_shopping_place_class.find_places({:resource => lookup_resource}).page 1
60
+ respond_with @auth_shopping_places
61
+ end
62
+
63
+
64
+ ##can be removed.
65
+ ##responds with 204, and empty response body, if all is ok.
66
+ def destroy
67
+ not_found if @auth_shopping_place.nil?
68
+ @auth_shopping_place.destroy
69
+ respond_with @auth_shopping_place
70
+ end
71
+
72
+ def search
73
+ args = {:query_string => params[:query_string]}
74
+ query_clause = Auth::Search::Main.es_six_finalize_search_query_clause(args)
75
+ @search_results = Auth.configuration.place_class.constantize.es.search(query_clause,{:wrapper => :load}).results
76
+ respond_to do |format|
77
+ ## with js.
78
+ format.js do
79
+ render :partial => "search_result", locals: {search_results: @search_results, suggestions: []}
80
+ end
81
+ format.json do
82
+ render json: @search_results.to_json
83
+ end
84
+ end
85
+ end
86
+
87
+ ## this permitted params is overridden in the dummy app, and as a result throws unpermitted parameters for the daughter app parameters, even though they are subsequently permitted, since super is called first.
88
+ def permitted_params
89
+
90
+ params.permit({place: [:full_address, :unit_number, :building, :street, :pin_code, :city, :country_state, :country, :latitude, :longitude]},:id,:query_string)
91
+
92
+
93
+ end
94
+
95
+ end
96
+
@@ -15,16 +15,11 @@ module Auth::Concerns::Shopping::ProductControllerConcern
15
15
  puts "current signed in resource: #{current_signed_in_resource}"
16
16
  @auth_shopping_product = params[:id] ? @auth_shopping_product_class.find_self(params[:id],current_signed_in_resource) : @auth_shopping_product_class.new(@auth_shopping_product_params)
17
17
  end
18
-
19
18
 
20
19
 
21
20
  def create
22
21
  check_for_create(@auth_shopping_product)
23
22
  @auth_shopping_product = add_owner_and_signed_in_resource(@auth_shopping_product,{:owner_is_current_resource => true})
24
- #puts "this is the auth shopping product"
25
- #puts @auth_shopping_product.embedded_document
26
- #puts @auth_shopping_product.embedded_document_path
27
- #@auth_shopping_product.send("#{@auth_shopping_product.embedded_document_path}=",@auth_shopping_product.embedded_document) if (@auth_shopping_product.embedded_document && @auth_shopping_product.embedded_document_path)
28
23
  @auth_shopping_product.save
29
24
  respond_with @auth_shopping_product
30
25
 
@@ -34,47 +29,63 @@ module Auth::Concerns::Shopping::ProductControllerConcern
34
29
  check_for_update(@auth_shopping_product)
35
30
  @auth_shopping_product = add_owner_and_signed_in_resource(@auth_shopping_product,{:owner_is_current_resource => true})
36
31
  @auth_shopping_product.assign_attributes(@auth_shopping_product_params)
37
-
38
- ## assigns the embedded document to the provided path.
39
- =begin
40
- if @auth_shopping_product.embedded_document_path
41
- curr_element = nil
42
- total_els = @auth_shopping_product.embedded_document_path.split(".").size
43
- @auth_shopping_product.embedded_document_path.split(".").each_with_index {|path,key|
44
- if key == (total_els - 1)
45
- if curr_element.nil?
46
- @auth_shopping_product.send(path + "=",@auth_shopping_product.embedded_document)
47
- else
48
- curr_element.send(path + "=",@auth_shopping_product.embedded_document) if (path =~ /[a-z]+/)
49
- curr_element.send(:[]=,path.to_i,@auth_shopping_product.embedded_document) if (path =~ /\d+/)
50
- end
51
- else
52
- if curr_element.nil?
53
- curr_element = @auth_shopping_product.send(path)
54
- else
55
- curr_element = curr_element.send(path) if (path =~ /[a-z]+/)
56
- curr_element = curr_element[path.to_i] if path=~/\d+/
57
- end
58
- end
59
- }
60
- end
61
- =end
62
- ## prune nil elements.
63
- ## at all levels.
64
-
65
32
  @auth_shopping_product.save
66
33
  respond_with @auth_shopping_product
67
34
 
68
35
  end
69
36
 
37
+ ## index can accept product bundle as a parameter.
38
+ ## like only show the bundles.
39
+ ## if we want to show that then?
40
+ ## okay so let us add that bundle parameter.
70
41
  def index
71
42
  instantiate_shopping_classes
72
- @auth_shopping_products = @auth_shopping_product_class.all
43
+ if params[:query_string]
44
+ if params[:autocomplete_bundle_name]
45
+ ## in this case, the autocomplete query has to be done.
46
+ args = {:query_string => params[:query_string]}
47
+ query = Auth::Search::Main.es_six_finalize_search_query_clause(args)
48
+ Auth.configuration.product_class.constantize.bundle_autocomplete_aggregation(query)
49
+ @auth_shopping_results = Auth.configuration.product_class.constantize.es.search(query,{:wrapper => :load}).results
50
+ end
51
+ elsif params[:group_by_bundles]
52
+ results = Auth.configuration.product_class.constantize.collection.aggregate([
53
+ {
54
+ "$match" => {
55
+ "bundle_name" => {
56
+ "$exists" => true
57
+ }
58
+ }
59
+ },
60
+ {
61
+ "$group" => {
62
+ "_id" => "$bundle_name",
63
+ "products" => {
64
+ "$push" => "$$ROOT"
65
+ }
66
+ }
67
+ }
68
+ ])
69
+ ## we need them keyed by the bundle name.
70
+ @products_grouped_by_bundle = {}
71
+ @auth_shopping_products = []
72
+ results.each do |result|
73
+ bundle_name = result["_id"]
74
+ products = result["products"].map{|c| c = Auth.configuration.product_class.constantize.new(c)}
75
+ @products_grouped_by_bundle[bundle_name] = products
76
+ end
77
+ else
78
+ @auth_shopping_products = @auth_shopping_product_class.all
79
+ end
80
+
81
+
82
+
73
83
  end
74
84
 
75
85
  def show
76
86
  instantiate_shopping_classes
77
87
  @auth_shopping_product = @auth_shopping_product_class.find(params[:id])
88
+
78
89
  ## will render show.json.erb if its a json request.
79
90
  end
80
91
 
@@ -92,15 +103,15 @@ module Auth::Concerns::Shopping::ProductControllerConcern
92
103
 
93
104
  end
94
105
 
95
- ## so now two additional keys get added
96
- ## one -> embedded_document_path
97
- ## two -> embedded_document.
98
- def permitted_params
99
- ## we just keep the embedded_document_path
100
- ## i need to change the controllers back to product
101
- ## and i need to
102
- pr = params.permit({:product => [:name,:price]})
106
+ ## first create a new product with a bundle.
107
+ ## so let me modify that part first.
108
+ def permitted_params
109
+ pr = params.permit({:product => [:name,:price,:bundle_name]})
103
110
  end
104
111
 
112
+
113
+
114
+
115
+
105
116
  end
106
117