ish_manager 0.1.8.36 → 0.1.8.37
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.
- checksums.yaml +4 -4
- data/app/controllers/ish_manager/newsitems_controller.rb +10 -23
- data/app/controllers/ish_manager/reports_controller.rb +8 -1
- data/app/controllers/ish_manager/sites_controller.rb +7 -7
- data/app/controllers/ish_manager/user_profiles_controller.rb +17 -0
- data/app/controllers/ish_manager/venues_controller.rb +1 -1
- data/app/helpers/ish_manager/application_helper.rb +4 -0
- data/app/models/ish_manager/ability.rb +18 -1
- data/app/views/ish_manager/application/_main_footer.haml +7 -4
- data/app/views/ish_manager/application/home.haml +1 -1
- data/app/views/ish_manager/newsitems/_index.haml +3 -3
- data/app/views/ish_manager/sites/_form.haml +3 -3
- data/app/views/ish_manager/sites/index.haml +3 -3
- data/app/views/ish_manager/user_profiles/edit.haml +12 -0
- data/app/views/ish_manager/user_profiles/edit.haml~ +1 -0
- data/app/views/ish_manager/user_profiles/index.haml +8 -6
- data/config/routes.rb +1 -0
- data/lib/tasks/ish_manager_tasks.rake +16 -4
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a622f2fe5deaa768db66c2050f042f7f6858f0e6
|
4
|
+
data.tar.gz: 3b56657b81f037d6276914ac85863ffd10d5999b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e0ac390eb79caf399a629cfe793e1ede81a9a26b7dc42839cde59ae31a42bbcab782944d8aca28bc67cda41edf407df5018c0a52337970393c5b04fc0497dba
|
7
|
+
data.tar.gz: 459f48e84910830234b1561d590d53cda99c34523fa2e0038c4186c7a954ceb9a1bd549c788eb79df58f97f767f13f9d981a70a33bdef17f5e121d5ba5fca644
|
@@ -18,32 +18,19 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
|
|
18
18
|
|
19
19
|
def create
|
20
20
|
n = Newsitem.new params[:newsitem].permit!
|
21
|
-
|
21
|
+
@resource = City.find params[:city_id] if params[:city_id]
|
22
|
+
@resource = Site.find params[:site_id] if params[:site_id]
|
23
|
+
authorize! :create_newsitem, @resource
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
url = edit_city_path( @city.id )
|
30
|
-
else
|
31
|
-
error = 'No Luck. ' + @city.errors.inspect
|
32
|
-
end
|
25
|
+
@resource.newsitems << n
|
26
|
+
flag = @resource.save
|
27
|
+
if flag
|
28
|
+
@resource.touch
|
29
|
+
else
|
30
|
+
error = 'No Luck. ' + @resource.errors.inspect
|
33
31
|
end
|
32
|
+
url = params[:city_id] ? edit_city_path( @resource.id ) : edit_site_path( @resource.id )
|
34
33
|
|
35
|
-
if params[:site_id]
|
36
|
-
@site = Site.find params[:site_id]
|
37
|
-
@site.newsitems << n
|
38
|
-
flag = @site.save
|
39
|
-
if flag
|
40
|
-
@site.touch
|
41
|
-
url = edit_site_path( @site.id )
|
42
|
-
else
|
43
|
-
error = 'No Luck. ' + @site.errors.inspect
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
34
|
if flag
|
48
35
|
flash[:notice] = 'Success'
|
49
36
|
redirect_to url
|
@@ -82,6 +82,13 @@ class IshManager::ReportsController < IshManager::ApplicationController
|
|
82
82
|
@site = Site.where( :id => params[:report][:site_id] ).first
|
83
83
|
@site ||= Site.find_by :domain => 'piousbox.com', :lang => :en
|
84
84
|
|
85
|
+
if @site
|
86
|
+
redirect_path = site_reports_path( @site.id )
|
87
|
+
end
|
88
|
+
if params[:report][:city_id]
|
89
|
+
redirect_path = city_path( params[:report][:city_id] )
|
90
|
+
end
|
91
|
+
|
85
92
|
# @report.user = @current_user || User.where( :username => 'anon' ).first
|
86
93
|
# @report.username = @report.user.username
|
87
94
|
@report[:lang] = @locale
|
@@ -127,7 +134,7 @@ class IshManager::ReportsController < IshManager::ApplicationController
|
|
127
134
|
end
|
128
135
|
|
129
136
|
format.html do
|
130
|
-
redirect_to
|
137
|
+
redirect_to redirect_path, :notice => 'Report was successfully created (but newsitem, no information).'
|
131
138
|
end
|
132
139
|
format.json { render :json => @report, :status => :created, :location => @report }
|
133
140
|
else
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class IshManager::SitesController < IshManager::ApplicationController
|
2
2
|
|
3
3
|
def index
|
4
|
-
authorize! :
|
5
|
-
@sites = Site.
|
4
|
+
authorize! :sites_index, ::Manager
|
5
|
+
@sites = Site.where( :is_trash => false ).order_by( :domainname => :desc, :lang => :desc )
|
6
6
|
end
|
7
7
|
|
8
8
|
# not trash
|
@@ -12,7 +12,7 @@ class IshManager::SitesController < IshManager::ApplicationController
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def show
|
15
|
-
@site = Site.find params[:id]
|
15
|
+
@site = Site.unscoped.find params[:id]
|
16
16
|
authorize! :show, @site
|
17
17
|
@galleries = @site.galleries.unscoped.where({ :is_trash => false }).page( params[:galleries_page] ).per( 10 )
|
18
18
|
@reports = @site.reports.unscoped.where({ :is_trash => false }).page( params[:reports_page] ).per( 10 )
|
@@ -40,11 +40,11 @@ class IshManager::SitesController < IshManager::ApplicationController
|
|
40
40
|
else
|
41
41
|
flash[:error] = 'No Luck. ' + @site.errors.inspect
|
42
42
|
end
|
43
|
-
redirect_to
|
43
|
+
redirect_to sites_path
|
44
44
|
end
|
45
45
|
|
46
46
|
def update
|
47
|
-
@site = Site.find params[:id]
|
47
|
+
@site = Site.unscoped.find params[:id]
|
48
48
|
authorize! :update, @site
|
49
49
|
|
50
50
|
if @site.update_attributes params[:site].permit!
|
@@ -52,7 +52,7 @@ class IshManager::SitesController < IshManager::ApplicationController
|
|
52
52
|
else
|
53
53
|
flash[:error] = 'No Luck'
|
54
54
|
end
|
55
|
-
redirect_to
|
55
|
+
redirect_to sites_path
|
56
56
|
end
|
57
57
|
|
58
58
|
def newsitem_delete
|
@@ -62,7 +62,7 @@ class IshManager::SitesController < IshManager::ApplicationController
|
|
62
62
|
n.delete
|
63
63
|
@site.save
|
64
64
|
flash[:notice] = 'Probably successfully deleted a newsitem.'
|
65
|
-
redirect_to
|
65
|
+
redirect_to site_path( @site.id )
|
66
66
|
end
|
67
67
|
|
68
68
|
end
|
@@ -11,5 +11,22 @@ class IshManager::UserProfilesController < IshManager::ApplicationController
|
|
11
11
|
authorize! :show, @user_profile
|
12
12
|
end
|
13
13
|
|
14
|
+
def edit
|
15
|
+
@profile = IshModels::UserProfile.find params[:id]
|
16
|
+
authorize! :edit, @profile
|
17
|
+
end
|
18
|
+
|
19
|
+
def update
|
20
|
+
@profile = IshModels::UserProfile.find params[:id]
|
21
|
+
authorize! :update, @profile
|
22
|
+
flag = @profile.update_attributes params[:ish_models_user_profile].permit!
|
23
|
+
if flag
|
24
|
+
flash[:notice] = "Updated profile #{@profile.email}"
|
25
|
+
else
|
26
|
+
flash[:alert] = "Cannot update profile: #{pp_errors @profile.errors.messages}"
|
27
|
+
end
|
28
|
+
redirect_to :action => :index
|
29
|
+
end
|
30
|
+
|
14
31
|
end
|
15
32
|
|
@@ -9,7 +9,24 @@ class IshManager::Ability
|
|
9
9
|
#
|
10
10
|
unless user.blank?
|
11
11
|
|
12
|
-
|
12
|
+
# role manager
|
13
|
+
if user.profile && user.profile.role_name == :manager
|
14
|
+
|
15
|
+
can [ :create_newsitem, :show ], ::City
|
16
|
+
|
17
|
+
can [ :cities_index, :home, :sites_index, :venues_index ], ::Manager
|
18
|
+
|
19
|
+
can [ :new ], Newsitem
|
20
|
+
|
21
|
+
can [ :new, :create ], Report
|
22
|
+
|
23
|
+
can [ :show, :edit, :update, :create_newsitem ], ::Site do |site|
|
24
|
+
!site.is_private && !site.is_trash
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
if user.profile && user.profile.sudoer?
|
13
30
|
can :manage, :all
|
14
31
|
can [ :home ], ::Manager
|
15
32
|
can :destroy, ::Photo
|
@@ -2,15 +2,16 @@
|
|
2
2
|
.container
|
3
3
|
%br
|
4
4
|
.row
|
5
|
-
.col-sm-
|
5
|
+
.col-sm-5
|
6
6
|
- if defined?( current_user ) && current_user
|
7
|
-
|
8
|
-
|
7
|
+
%ul
|
8
|
+
%li >[ #{current_user.email} ]<
|
9
|
+
%li >[ #{current_user.profile.role_name} ]<
|
9
10
|
- else
|
10
11
|
Please log in
|
11
12
|
= link_to '[+]', main_app.new_user_session_path
|
12
13
|
|
13
|
-
.col-sm-
|
14
|
+
.col-sm-5
|
14
15
|
%br
|
15
16
|
\~__^
|
16
17
|
%br
|
@@ -18,3 +19,5 @@
|
|
18
19
|
%br
|
19
20
|
%br
|
20
21
|
%br
|
22
|
+
.col-sm.2
|
23
|
+
= button_to 'Logout', main_app.destroy_user_session_path, :method => :delete
|
@@ -15,9 +15,9 @@
|
|
15
15
|
.col-sm-12
|
16
16
|
%h2 Newsitems (#{newsitems.count}) #{link_to '[+]', new_newsitem }
|
17
17
|
= paginate newsitems, :param_name => 'newsitems_page'
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
- newsitems.each do |n|
|
19
|
+
.panel
|
20
|
+
.panel-body
|
21
21
|
%ul
|
22
22
|
%li
|
23
23
|
= link_to '[~]', edit_url.call( n )
|
@@ -36,14 +36,14 @@
|
|
36
36
|
|
37
37
|
.row
|
38
38
|
.small-4.columns
|
39
|
-
= f.label :is_trash
|
40
39
|
= f.check_box :is_trash
|
40
|
+
= f.label :is_trash
|
41
41
|
.small-4.columns
|
42
|
-
= f.label :is_private
|
43
42
|
= f.check_box :is_private
|
43
|
+
= f.label :is_private
|
44
44
|
.small-4.columns
|
45
|
-
= f.label :is_ads_enabled
|
46
45
|
= f.check_box :is_ads_enabled
|
46
|
+
= f.label :is_ads_enabled
|
47
47
|
|
48
48
|
.row
|
49
49
|
.large-12.columns
|
@@ -3,11 +3,11 @@
|
|
3
3
|
%h3 Sites
|
4
4
|
.row
|
5
5
|
- @sites.each do |site|
|
6
|
-
.col-xs-6
|
6
|
+
.col-xs-12.col-md-6.col-lg-4
|
7
7
|
.panel.panel-primary
|
8
8
|
.panel-body
|
9
|
-
%
|
10
|
-
= link_to "
|
9
|
+
%h5
|
10
|
+
= link_to "#{site.domain}/#{site.lang}", site_path( site )
|
11
11
|
= link_to '[~]', edit_site_path( site )
|
12
12
|
.title Title: #{site.title}
|
13
13
|
.subhead Subhead: #{site.subhead}
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -1,12 +1,14 @@
|
|
1
1
|
|
2
|
-
%h1
|
2
|
+
%h1
|
3
|
+
User Profiles (#{@user_profiles.count})
|
4
|
+
= link_to '[+]', new_user_profile_path
|
3
5
|
|
4
6
|
%ul
|
5
7
|
- @user_profiles.each do |profile|
|
6
|
-
|
7
|
-
|
8
|
+
.panel
|
8
9
|
%ul
|
9
|
-
%li= profile
|
10
|
-
%li
|
11
|
-
%li
|
10
|
+
%li= link_to '[edit]', edit_user_profile_path( profile )
|
11
|
+
%li Email: #{profile.email}
|
12
|
+
%li Name: #{profile.name}
|
13
|
+
%li Role: #{profile.role_name}
|
12
14
|
%br
|
data/config/routes.rb
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
|
2
|
+
namespace :ish do
|
3
|
+
|
4
|
+
desc "every user needs a user_profile"
|
5
|
+
task :generate_user_profiles => :environment do
|
6
|
+
User.all.map do |u|
|
7
|
+
unless u.profile
|
8
|
+
p = ::IshModels::UserProfile.new :email => u.email, :user => u, :role_name => :guy
|
9
|
+
u.profile = p
|
10
|
+
u.save && p.save && print('.')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
puts 'OK'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -262,6 +262,8 @@ files:
|
|
262
262
|
- app/views/ish_manager/tags/index.haml
|
263
263
|
- app/views/ish_manager/tags/new.haml
|
264
264
|
- app/views/ish_manager/tags/show.haml
|
265
|
+
- app/views/ish_manager/user_profiles/edit.haml
|
266
|
+
- app/views/ish_manager/user_profiles/edit.haml~
|
265
267
|
- app/views/ish_manager/user_profiles/index.haml
|
266
268
|
- app/views/ish_manager/user_profiles/index.haml~
|
267
269
|
- app/views/ish_manager/users/_index.haml
|