ish_manager 0.1.8.16 → 0.1.8.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/ish_manager/application_controller.rb +1 -0
- data/app/controllers/ish_manager/reports_controller.rb +91 -6
- data/app/views/ish_manager/reports/#index.haml# +28 -0
- data/app/views/ish_manager/reports/_form.haml +14 -8
- data/app/views/ish_manager/reports/edit.haml +2 -2
- data/app/views/ish_manager/reports/index.haml +3 -1
- data/app/views/ish_manager/reports/new.haml +3 -3
- data/app/views/ish_manager/reports/show.haml +3 -1
- data/app/views/layouts/ish_manager/application.haml +7 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 693f4c7000897e29edddc01f32b3cf931f3cb536
|
4
|
+
data.tar.gz: df2e55471622d9db7115257fd773bd4a6b02fb3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3739f3c9abbdf6c4430af352a1876e1aeae88f24e77fba1668080c02a835327052f1b7469c60b0a0d37eef546f8ea98e1337beb47fc5db0a914637d155646a1
|
7
|
+
data.tar.gz: 5de14e8ba68634674e189cadcdaecc7fcc7ea086a062b545c249e628d1651792173f2bec0bd4d8c2ec07b6d8bd961494527a599537bb7c8b5a9b6b93cd480c7a
|
@@ -1,12 +1,11 @@
|
|
1
1
|
|
2
2
|
class IshManager::ReportsController < IshManager::ApplicationController
|
3
3
|
|
4
|
-
|
5
|
-
# before_filter :set_lists
|
4
|
+
before_action :set_lists
|
6
5
|
|
7
6
|
def index
|
8
7
|
authorize! :index, Report
|
9
|
-
@reports = Report.unscoped.where( :is_trash => false ).page( params[:reports_page] ).per( Report::PER_PAGE )
|
8
|
+
@reports = Report.unscoped.order_by( :created_at => :desc ).where( :is_trash => false ).page( params[:reports_page] ).per( Report::PER_PAGE )
|
10
9
|
if false === params[:site]
|
11
10
|
@reports = @reports.where( :site_id => nil )
|
12
11
|
end
|
@@ -23,10 +22,12 @@ class IshManager::ReportsController < IshManager::ApplicationController
|
|
23
22
|
|
24
23
|
def edit
|
25
24
|
@report = Report.unscoped.find params[:id]
|
25
|
+
authorize! :edit, @report
|
26
26
|
end
|
27
27
|
|
28
28
|
def destroy
|
29
29
|
@report = Report.unscoped.find params[:id]
|
30
|
+
authorize! :destroy, @report
|
30
31
|
@report.is_trash = true
|
31
32
|
@report.save
|
32
33
|
redirect_to request.referrer
|
@@ -40,7 +41,7 @@ class IshManager::ReportsController < IshManager::ApplicationController
|
|
40
41
|
photo = Photo.new
|
41
42
|
photo.photo = params[:report][:photo]
|
42
43
|
photo.report_id = @report.id
|
43
|
-
photo.user = @report.user
|
44
|
+
# photo.user = @report.user
|
44
45
|
photo.is_public = @report.is_public
|
45
46
|
photo.is_trash = false
|
46
47
|
photo.save
|
@@ -48,9 +49,9 @@ class IshManager::ReportsController < IshManager::ApplicationController
|
|
48
49
|
params[:report][:photo] = nil
|
49
50
|
|
50
51
|
respond_to do |format|
|
51
|
-
if @report.update_attributes(params[:report].permit
|
52
|
+
if @report.update_attributes(params[:report].permit!)
|
52
53
|
format.html do
|
53
|
-
redirect_to
|
54
|
+
redirect_to report_path(@report), :notice => 'Report was successfully updated.'
|
54
55
|
end
|
55
56
|
format.json { head :ok }
|
56
57
|
else
|
@@ -60,5 +61,89 @@ class IshManager::ReportsController < IshManager::ApplicationController
|
|
60
61
|
end
|
61
62
|
end
|
62
63
|
|
64
|
+
def new
|
65
|
+
@report = Report.new
|
66
|
+
authorize! :new, @report
|
67
|
+
@tags_list = Tag.all.where( :is_public => true ).list
|
68
|
+
@sites_list = Site.all.list
|
69
|
+
@cities_list = City.all.list
|
70
|
+
@venues_list = Venue.all.list
|
71
|
+
|
72
|
+
respond_to do |format|
|
73
|
+
format.html do
|
74
|
+
render
|
75
|
+
end
|
76
|
+
format.json { render :json => @report }
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def create
|
81
|
+
@report = Report.new params[:report].permit!
|
82
|
+
authorize! :create, @report
|
83
|
+
|
84
|
+
@site = Site.where( :id => params[:report][:site_id] ).first
|
85
|
+
@site ||= Site.find_by :domain => 'piousbox.com', :lang => :en
|
86
|
+
|
87
|
+
# @report.user = @current_user || User.where( :username => 'anon' ).first
|
88
|
+
# @report.username = @report.user.username
|
89
|
+
@report[:lang] = @locale
|
90
|
+
@report.name_seo ||= @report.id
|
91
|
+
@report.is_feature = false
|
92
|
+
@report.site = @site
|
93
|
+
|
94
|
+
saved = false
|
95
|
+
verified = true # verify_recaptcha( :model => @report, :message => 'There is a problem with recaptcha.' ) # @TODO: what this
|
96
|
+
if Rails.env.development?
|
97
|
+
verified = true
|
98
|
+
end
|
99
|
+
|
100
|
+
if verified
|
101
|
+
saved = @report.save
|
102
|
+
end
|
103
|
+
|
104
|
+
respond_to do |format|
|
105
|
+
if saved
|
106
|
+
|
107
|
+
# photo
|
108
|
+
photo = Photo.new
|
109
|
+
photo.photo = params[:report][:photo]
|
110
|
+
# photo.user = @report.user
|
111
|
+
photo.is_public = @report.is_public
|
112
|
+
photo.is_trash = false
|
113
|
+
photo.report_id = @report.id
|
114
|
+
photo.save
|
115
|
+
|
116
|
+
# for homepage
|
117
|
+
if @report.is_public
|
118
|
+
n = Newsitem.new
|
119
|
+
n.report = @report
|
120
|
+
n.descr = @report.name + ' ' + @report.subhead
|
121
|
+
# n.user = @report.user
|
122
|
+
@site.newsitems << n
|
123
|
+
if @site.save
|
124
|
+
;
|
125
|
+
else
|
126
|
+
flash[:error] = (flash[:error]||'') + 'City could not be saved (newsitem). '
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
format.html do
|
131
|
+
redirect_to reports_path, :notice => 'Report was successfully created (but newsitem, no information).'
|
132
|
+
end
|
133
|
+
format.json { render :json => @report, :status => :created, :location => @report }
|
134
|
+
else
|
135
|
+
format.html do
|
136
|
+
flash[:error] = @report.errors.inspect
|
137
|
+
@tags_list = Tag.all.where( :is_public => true ).list
|
138
|
+
@sites_list = Site.all.list
|
139
|
+
@cities_list = City.all.list
|
140
|
+
|
141
|
+
render :action => "new"
|
142
|
+
end
|
143
|
+
format.json { render :json => @report.errors, :status => :unprocessable_entity }
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
63
148
|
end
|
64
149
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
.row
|
3
|
+
.large-12.columns
|
4
|
+
%h3
|
5
|
+
Reports Index (#{@reports.length})
|
6
|
+
- if @site
|
7
|
+
In #{@site.domain}/#{@site.lang}
|
8
|
+
= link_to '[+]', new_report_path
|
9
|
+
= paginate @reports, :param_name => :reports_page
|
10
|
+
|
11
|
+
%ol
|
12
|
+
- @reports.each do |report|
|
13
|
+
%li
|
14
|
+
= link_to '[~]', edit_report_path( report )
|
15
|
+
= link_to '[x]', report_path( report ), :method => :delete, :data => { :confirm => 'Are you sure?' }
|
16
|
+
- if report.is_public
|
17
|
+
[public ]
|
18
|
+
- else
|
19
|
+
[private]
|
20
|
+
= link_to report.name, report_path( report )
|
21
|
+
%br
|
22
|
+
.gray
|
23
|
+
- if report.site
|
24
|
+
Site #{report.site.domain}/#{report.site.lang}
|
25
|
+
%br
|
26
|
+
= report.created_at
|
27
|
+
= paginate @reports, :param_name => :reports_page
|
28
|
+
|
@@ -1,18 +1,24 @@
|
|
1
1
|
|
2
|
-
- url ||=
|
3
|
-
= form_for
|
2
|
+
- url ||= reports_path
|
3
|
+
= form_for report, :url => url, :html => { :multipart => true } do |f|
|
4
4
|
|
5
|
-
- if
|
5
|
+
- if report.errors.any?
|
6
6
|
#error_explanation
|
7
7
|
%h3= t('e.there_are_errors')
|
8
8
|
|
9
9
|
%ul
|
10
|
-
-
|
10
|
+
- report.errors.full_messages.each do |msg|
|
11
11
|
%li= msg
|
12
12
|
|
13
|
-
.
|
14
|
-
|
15
|
-
|
13
|
+
.field
|
14
|
+
= f.label :name
|
15
|
+
= f.text_field :name
|
16
|
+
.field
|
17
|
+
= f.label :subhead
|
18
|
+
= f.text_area :subhead
|
19
|
+
.field
|
20
|
+
= f.label :descr
|
21
|
+
.descr= f.text_area :descr, :class => 'tinymce'
|
16
22
|
|
17
23
|
.row
|
18
24
|
.large-6.columns
|
@@ -36,7 +42,7 @@
|
|
36
42
|
|
37
43
|
= f.file_field :photo
|
38
44
|
|
39
|
-
= recaptcha_tags
|
45
|
+
-# = recaptcha_tags
|
40
46
|
|
41
47
|
= f.submit
|
42
48
|
|
@@ -5,6 +5,7 @@
|
|
5
5
|
Reports Index (#{@reports.length})
|
6
6
|
- if @site
|
7
7
|
In #{@site.domain}/#{@site.lang}
|
8
|
+
= link_to '[+]', new_report_path
|
8
9
|
= paginate @reports, :param_name => :reports_page
|
9
10
|
|
10
11
|
%ol
|
@@ -21,6 +22,7 @@
|
|
21
22
|
.gray
|
22
23
|
- if report.site
|
23
24
|
Site #{report.site.domain}/#{report.site.lang}
|
24
|
-
|
25
|
+
%br
|
26
|
+
= report.created_at
|
25
27
|
= paginate @reports, :param_name => :reports_page
|
26
28
|
|
@@ -12,10 +12,13 @@
|
|
12
12
|
%body
|
13
13
|
.bg-white
|
14
14
|
= render :partial => 'ish_manager/application/main_header'
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
.container
|
16
|
+
.row
|
17
|
+
.col-sm-12
|
18
|
+
- if notice
|
19
|
+
%p.notice= notice
|
20
|
+
- if alert
|
21
|
+
%p.alert= alert
|
19
22
|
.container
|
20
23
|
= yield
|
21
24
|
= render :partial => 'ish_manager/application/main_footer'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ish_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.8.
|
4
|
+
version: 0.1.8.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -208,6 +208,7 @@ files:
|
|
208
208
|
- app/views/ish_manager/photos/_multinew.haml~
|
209
209
|
- app/views/ish_manager/photos/show.haml
|
210
210
|
- app/views/ish_manager/photos/without_gallery.haml
|
211
|
+
- app/views/ish_manager/reports/#index.haml#
|
211
212
|
- app/views/ish_manager/reports/_form.haml
|
212
213
|
- app/views/ish_manager/reports/_index.haml
|
213
214
|
- app/views/ish_manager/reports/edit.haml
|