phcdevworks_real_estate 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +0 -0
  4. data/Rakefile +32 -0
  5. data/app/assets/config/phcdevworks_real_estate_manifest.js +2 -0
  6. data/app/assets/javascripts/phcdevworks_real_estate/application.js +2 -0
  7. data/app/assets/stylesheets/phcdevworks_real_estate/application.scss +2 -0
  8. data/app/assets/stylesheets/phcdevworks_real_estate/property/features.css +4 -0
  9. data/app/assets/stylesheets/phcdevworks_real_estate/property/listings.css +4 -0
  10. data/app/controllers/phcdevworks_real_estate/application_controller.rb +13 -0
  11. data/app/controllers/phcdevworks_real_estate/property/features_controller.rb +80 -0
  12. data/app/controllers/phcdevworks_real_estate/property/listings_controller.rb +80 -0
  13. data/app/helpers/phcdevworks_real_estate/application_helper.rb +4 -0
  14. data/app/helpers/phcdevworks_real_estate/property/features_helper.rb +4 -0
  15. data/app/helpers/phcdevworks_real_estate/property/listings_helper.rb +4 -0
  16. data/app/jobs/phcdevworks_real_estate/application_job.rb +4 -0
  17. data/app/mailers/phcdevworks_real_estate/application_mailer.rb +6 -0
  18. data/app/models/phcdevworks_real_estate/application_record.rb +5 -0
  19. data/app/models/phcdevworks_real_estate/property.rb +7 -0
  20. data/app/models/phcdevworks_real_estate/property/feature.rb +12 -0
  21. data/app/models/phcdevworks_real_estate/property/listing.rb +25 -0
  22. data/app/views/layouts/phcdevworks_real_estate/application.html.erb +94 -0
  23. data/app/views/layouts/phcdevworks_real_estate/components/backend/footer/_footer.html.erb +16 -0
  24. data/app/views/layouts/phcdevworks_real_estate/components/backend/navigation/_top_menu.html.erb +37 -0
  25. data/app/views/layouts/phcdevworks_real_estate/components/backend/sidebars/_side_menu.html.erb +213 -0
  26. data/app/views/phcdevworks_real_estate/property/features/_form.html.erb +18 -0
  27. data/app/views/phcdevworks_real_estate/property/features/edit.html.erb +37 -0
  28. data/app/views/phcdevworks_real_estate/property/features/index.html.erb +62 -0
  29. data/app/views/phcdevworks_real_estate/property/features/new.html.erb +37 -0
  30. data/app/views/phcdevworks_real_estate/property/features/show.html.erb +64 -0
  31. data/app/views/phcdevworks_real_estate/property/listings/_form.html.erb +96 -0
  32. data/app/views/phcdevworks_real_estate/property/listings/edit.html.erb +37 -0
  33. data/app/views/phcdevworks_real_estate/property/listings/index.html.erb +70 -0
  34. data/app/views/phcdevworks_real_estate/property/listings/new.html.erb +37 -0
  35. data/app/views/phcdevworks_real_estate/property/listings/show.html.erb +50 -0
  36. data/config/initializers/friendly_id.rb +107 -0
  37. data/config/routes.rb +18 -0
  38. data/db/migrate/20180918034641_create_join_table_features_listings.rb +8 -0
  39. data/db/migrate/20190824010811_create_phcdevworks_real_estate_property_listings.rb +34 -0
  40. data/db/migrate/20190824011000_create_phcdevworks_real_estate_property_features.rb +15 -0
  41. data/lib/phcdevworks_real_estate.rb +5 -0
  42. data/lib/phcdevworks_real_estate/engine.rb +33 -0
  43. data/lib/phcdevworks_real_estate/version.rb +3 -0
  44. data/lib/tasks/phcdevworks_real_estate_tasks.rake +4 -0
  45. metadata +302 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 14adcbf1ed2a5ee471a90db5bf5121bc343e2a1110dc30b714856f6137a33c83
4
+ data.tar.gz: 625b9aeb4985176e05afb247515be32466910f886563df460f8eb5d9a6b86a5f
5
+ SHA512:
6
+ metadata.gz: 5f82a10dfeb6f90a37dcfa93483e5aa12f1ab999a328a5aa71f61160e6b811ba87dbb4ef8c0c701ebac627acc68b98636eb3638cd1ca7ca2d6683fc498fcecc3
7
+ data.tar.gz: f76e0ffedc5961dfb78020523f21a848ac10f15306a033cef92d5009e8e0e26d8a14a526dd3e10fe7a6609cf5c8f796b13d3992171bcf9b6420b79bb0523169e
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2019 - PHCDEVWORKS
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1,32 @@
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
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'PhcdevworksRealEstate'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("test/test_app/Rakefile", __dir__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ require 'bundler/gem_tasks'
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'test'
28
+ t.pattern = 'test/**/*_test.rb'
29
+ t.verbose = false
30
+ end
31
+
32
+ task default: :test
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/phcdevworks_real_estate .js
2
+ //= link_directory ../stylesheets/phcdevworks_real_estate .scss
@@ -0,0 +1,2 @@
1
+ // Load Admin Theme
2
+ //= require phcthemes_admin_panel_pack_coloradmin
@@ -0,0 +1,2 @@
1
+ // Load Admin Theme
2
+ @import "phcthemes_admin_panel_pack_coloradmin";
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,13 @@
1
+ module PhcdevworksRealEstate
2
+ class ApplicationController < ActionController::Base
3
+
4
+ # Security Filters
5
+ protect_from_forgery with: :exception
6
+
7
+ # Load Requried Helper Files
8
+ helper PhcdevworksActiveMenus::Engine.helpers
9
+ helper PhcdevworksNotifications::Engine.helpers
10
+ helper PhcdevworksTitleseo::Engine.helpers
11
+
12
+ end
13
+ end
@@ -0,0 +1,80 @@
1
+ require_dependency "phcdevworks_real_estate/application_controller"
2
+
3
+ module PhcdevworksRealEstate
4
+ class Property::FeaturesController < ApplicationController
5
+
6
+ # Filters & Security
7
+ #include PhcdevworksCore::PhcpluginsHelper
8
+ before_action :authenticate_user!
9
+ before_action :set_paper_trail_whodunnit
10
+ before_action :set_property_feature, only: [:show, :edit, :update, :destroy]
11
+
12
+ # GET /property/features
13
+ def index
14
+ @property_features = Property::Feature.all
15
+ end
16
+
17
+ # GET /property/features/1
18
+ def show
19
+ end
20
+
21
+ # GET /property/features/new
22
+ def new
23
+ @property_feature = Property::Feature.new
24
+ end
25
+
26
+ # GET /property/features/1/edit
27
+ def edit
28
+ end
29
+
30
+ # POST /property/features
31
+ def create
32
+ @property_feature = Property::Feature.new(property_feature_params)
33
+ @property_feature.user_id = current_user.id
34
+ respond_to do |format|
35
+ if @property_feature.save
36
+ format.html { redirect_to property_features_path, :flash => { :success => 'Author has been Added.' }}
37
+ format.json { render :show, status: :created, location: @property_feature }
38
+ else
39
+ format.html { render :new }
40
+ format.json { render json: @property_feature.errors, status: :unprocessable_entity }
41
+ end
42
+ end
43
+ end
44
+
45
+ # PATCH/PUT /property/features/1
46
+ def update
47
+ respond_to do |format|
48
+ if @property_feature.update(property_feature_params)
49
+ format.html { redirect_to property_features_path, :flash => { :notice => 'Property Feature has been Updated.' }}
50
+ format.json { render :show, status: :ok, location: @property_feature }
51
+ else
52
+ format.html { render :edit }
53
+ format.json { render json: @property_feature.errors, status: :unprocessable_entity }
54
+ end
55
+ end
56
+ end
57
+
58
+ # DELETE /property/features/1
59
+ def destroy
60
+ @property_feature.destroy
61
+ respond_to do |format|
62
+ format.html { redirect_to property_features_path, :flash => { :error => 'Category and Connections have all been Removed.' }}
63
+ format.json { head :no_content }
64
+ end
65
+ end
66
+
67
+ private
68
+
69
+ # Callbacks
70
+ def set_property_feature
71
+ @property_feature = Property::Feature.find(params[:id])
72
+ end
73
+
74
+ # Whitelist
75
+ def property_feature_params
76
+ params.require(:property_feature).permit(:feature_name)
77
+ end
78
+
79
+ end
80
+ end
@@ -0,0 +1,80 @@
1
+ require_dependency "phcdevworks_real_estate/application_controller"
2
+
3
+ module PhcdevworksRealEstate
4
+ class Property::ListingsController < ApplicationController
5
+
6
+ # Filters & Security
7
+ #include PhcdevworksCore::PhcpluginsHelper
8
+ before_action :authenticate_user!
9
+ before_action :set_paper_trail_whodunnit
10
+ before_action :set_property_listing, only: [:show, :edit, :update, :destroy]
11
+
12
+ # GET /property/listings
13
+ def index
14
+ @property_listings = Property::Listing.all
15
+ end
16
+
17
+ # GET /property/listings/1
18
+ def show
19
+ end
20
+
21
+ # GET /property/listings/new
22
+ def new
23
+ @property_listing = Property::Listing.new
24
+ end
25
+
26
+ # GET /property/listings/1/edit
27
+ def edit
28
+ end
29
+
30
+ # POST /property/listings
31
+ def create
32
+ @property_listing = Property::Listing.new(property_listing_params)
33
+ @property_listing.user_id = current_user.id
34
+ respond_to do |format|
35
+ if @property_listing.save
36
+ format.html { redirect_to property_listings_path, :flash => { :success => 'Author has been Added.' }}
37
+ format.json { render :show, status: :created, location: @property_listing }
38
+ else
39
+ format.html { render :new }
40
+ format.json { render json: @property_listing.errors, status: :unprocessable_entity }
41
+ end
42
+ end
43
+ end
44
+
45
+ # PATCH/PUT /property/listings/1
46
+ def update
47
+ respond_to do |format|
48
+ if @property_listing.update(property_listing_params)
49
+ format.html { redirect_to property_listings_path, :flash => { :notice => 'Property Listing has been Updated.' }}
50
+ format.json { render :show, status: :ok, location: @property_listing }
51
+ else
52
+ format.html { render :edit }
53
+ format.json { render json: @property_listing.errors, status: :unprocessable_entity }
54
+ end
55
+ end
56
+ end
57
+
58
+ # DELETE /property/listings/1
59
+ def destroy
60
+ @property_listing.destroy
61
+ respond_to do |format|
62
+ format.html { redirect_to property_listings_path, :flash => { :error => 'Category and Connections have all been Removed.' }}
63
+ format.json { head :no_content }
64
+ end
65
+ end
66
+
67
+ private
68
+
69
+ # Callbacks
70
+ def set_property_listing
71
+ @property_listing = Property::Listing.find(params[:id])
72
+ end
73
+
74
+ # Whitelist
75
+ def property_listing_params
76
+ params.require(:property_listing).permit(:listing_title, :listing_description, :listing_street_address, :listing_price, :listing_area, :listing_property_area, :listing_garage_area, :listing_room, :listing_bed, :listing_bath, :listing_garage, :listing_type, :listing_status, :listing_year_built, :listing_energy_class, :listing_leed_rating, :listing_upload, :user_id, :org_id, gallery_upload: [], feature_ids: [])
77
+ end
78
+
79
+ end
80
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksRealEstate
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksRealEstate
2
+ module Property::FeaturesHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksRealEstate
2
+ module Property::ListingsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module PhcdevworksRealEstate
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module PhcdevworksRealEstate
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module PhcdevworksRealEstate
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ module PhcdevworksRealEstate
2
+ module Property
3
+ def self.table_name_prefix
4
+ 'phcdevworks_real_estate_property_'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ module PhcdevworksRealEstate
2
+ class Property::Feature < ApplicationRecord
3
+
4
+ # Relationships
5
+ has_and_belongs_to_many :listings, class_name: 'Phcreallistingspro::Property::Listing', :join_table => 'features_listings'
6
+
7
+ # Validation for Form Fields
8
+ validates :feature_name,
9
+ presence: true
10
+
11
+ end
12
+ end
@@ -0,0 +1,25 @@
1
+ module PhcdevworksRealEstate
2
+ class Property::Listing < ApplicationRecord
3
+
4
+ # Image Uploading
5
+ has_one_attached :listing_upload
6
+ has_many_attached :gallery_upload
7
+
8
+ # Relationships
9
+ has_and_belongs_to_many :features, class_name: 'Phcreallistingspro::Property::Feature', :join_table => 'features_listings'
10
+
11
+ # Validation for Form Fields
12
+ validates :listing_title,
13
+ presence: true
14
+
15
+ validates :listing_description,
16
+ presence: true
17
+
18
+ validates :listing_street_address,
19
+ presence: true
20
+
21
+ validates :listing_price,
22
+ presence: true
23
+
24
+ end
25
+ end
@@ -0,0 +1,94 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+
5
+ <!-- SEO System -->
6
+ <% phc_seo_title "RealEstate by PHCDevworks" %>
7
+ <% phc_seo_description "Ruby on Rails 6 real estate listings management." %>
8
+ <!-- SEO System -->
9
+
10
+ <!-- SEO and Site Description -->
11
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
12
+ <title><%= yield(:phc_seo_title) %></title>
13
+ <meta name="description" content="<%= yield(:phc_seo_description) %>">
14
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
15
+ <link rel="canonical" href="http://phcdevworks.com">
16
+ <!-- SEO and Site Description -->
17
+
18
+ <!-- Rails Security Tags -->
19
+ <%= csrf_meta_tags %>
20
+ <%= csp_meta_tag %>
21
+ <!-- Rails Security Tags -->
22
+
23
+ <!-- CSS Styles -->
24
+ <%= stylesheet_link_tag 'phcdevworks_real_estate/application', media: 'all', 'data-turbolinks-track': 'reload' %>
25
+ <!-- CSS Styles -->
26
+
27
+ <!-- Font -->
28
+ <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400%7CRaleway:300,400,500,600,700%7CLato:300,400,400italic,600,700"/>
29
+ <!-- Font -->
30
+
31
+ </head>
32
+ <body>
33
+
34
+ <!-- Page Container -->
35
+ <div id="page-container" class="fade page-sidebar-fixed page-header-fixed">
36
+
37
+ <!-- Page Header -->
38
+ <div id="header" class="header navbar-default">
39
+ <%= render 'layouts/phcdevworks_real_estate/components/backend/navigation/top_menu' %>
40
+ </div>
41
+ <!-- Page Header -->
42
+
43
+ <!-- Page Sidebar -->
44
+ <div id="sidebar" class="sidebar">
45
+ <%= render 'layouts/phcdevworks_real_estate/components/backend/sidebars/side_menu' %>
46
+ </div>
47
+ <div class="sidebar-bg"></div>
48
+ <!-- Page Sidebar -->
49
+
50
+ <!-- Page Content -->
51
+ <div id="content" class="content">
52
+ <%= render 'phcdevworks_notifications/bootstrap/notifications' %>
53
+ <%= yield %>
54
+ </div>
55
+ <!-- Page Content -->
56
+
57
+ <!-- Footer Content -->
58
+ <div id="footer" class="footer mb-4">
59
+ <%= render 'layouts/phcdevworks_real_estate/components/backend/footer/footer' %>
60
+ </div>
61
+ <!-- Footer Content -->
62
+
63
+ </div>
64
+ <!-- Page Container -->
65
+
66
+ <!-- JavaScript -->
67
+ <%= javascript_include_tag "phcdevworks_real_estate/application", 'data-turbolinks-track': 'reload' %>
68
+ <!-- JavaScript -->
69
+
70
+ <!-- JavaScript CKEditor -->
71
+ <script>
72
+ ClassicEditor.create( document.querySelector( '#editor' ) )
73
+ .then( editor => {
74
+ window.editor = editor;
75
+ const wordCountPlugin = editor.plugins.get( 'WordCount' );
76
+ const wordCountWrapper = document.getElementById( 'word-count' );
77
+ wordCountWrapper.appendChild( wordCountPlugin.wordCountContainer );
78
+ } )
79
+ .catch( err => {
80
+ console.error( err.stack );
81
+ } );
82
+ </script>
83
+ <!-- JavaScript CKEditor -->
84
+
85
+ <!-- JavaScript Loader -->
86
+ <script>
87
+ $(document).ready(function() {
88
+ App.init();
89
+ });
90
+ </script>
91
+ <!-- JavaScript Loader -->
92
+
93
+ </body>
94
+ </html>