userswitch 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -36
- data/app/controllers/userswitch/switch_controller.rb +10 -0
- data/config/routes.rb +3 -0
- data/lib/userswitch/engine.rb +3 -0
- data/lib/userswitch/version.rb +1 -1
- data/lib/userswitch.rb +23 -2
- data/us1.png +0 -0
- data/us2.png +0 -0
- data/us3.png +0 -0
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bec449f560253bfeb5acbda00ba6fb3ba351cf85
|
4
|
+
data.tar.gz: 939242e09521784854f835a858ee0ff2fe222527
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5f77f9d9df73af080706911c6afd87dac67adf0a5132787d36cdc3b473c386ba4b119922d05f6a49a0abef84ae13207829ff14a86a455f72694fdb931638360
|
7
|
+
data.tar.gz: fe50c37355e92f6170edbfe8a646a42fa51f91a84324c19352ca2ff5ca8c79fa1dfa801a4566ccc13fdd6ad748371d354207c3d063a6cfdf4f94742a897daa8a
|
data/README.md
CHANGED
@@ -1,41 +1,11 @@
|
|
1
1
|
# Userswitch
|
2
2
|
|
3
|
-
|
3
|
+
Userswitch is a Rails plugin for switching between commonly used roles and users. It's particularly useful for development and staging environments when you often need to switch between various accounts. It saves you from the hassle of logging in or out.
|
4
4
|
|
5
|
-
|
5
|
+
Calling users with (Showing only users with negative id):
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'userswitch'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install userswitch
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/userswitch. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
-
|
37
|
-
|
38
|
-
## License
|
39
|
-
|
40
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
7
|
+
``` Userswitch.users.html_safe ```
|
41
8
|
|
9
|
+
![pic1](us1.png)
|
10
|
+
![pic2](us2.png)
|
11
|
+
![pic3](us3.png)
|
data/config/routes.rb
ADDED
data/lib/userswitch/version.rb
CHANGED
data/lib/userswitch.rb
CHANGED
@@ -1,5 +1,26 @@
|
|
1
|
-
require
|
1
|
+
require 'userswitch/version'
|
2
|
+
require 'userswitch/engine'
|
2
3
|
|
3
4
|
module Userswitch
|
4
|
-
|
5
|
+
def initialize_switch_users
|
6
|
+
# AdminUser.where('id < 0')
|
7
|
+
# TODO ovo ce ucitat iz file-a ili seedova sere, Adminusere itd.
|
8
|
+
# nece bit where
|
9
|
+
User.where('id < 0')
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_button_from_user
|
13
|
+
ceo_html = ''
|
14
|
+
initialize_switch_users.each do |user|
|
15
|
+
# pogleda koja je rola, ovisno o roli dodjelimo clase iz html-a css-a
|
16
|
+
ceo_html += "<a href=\"/change-user/#{user.id}\" class=\"btn #{user.id} btn-outline btn-info btn-sm\">#{user.email}</a> \n"
|
17
|
+
end
|
18
|
+
ceo_html.html_safe
|
19
|
+
end
|
20
|
+
|
21
|
+
def users
|
22
|
+
create_button_from_user
|
23
|
+
end
|
24
|
+
|
25
|
+
module_function :users, :create_button_from_user, :initialize_switch_users
|
5
26
|
end
|
data/us1.png
ADDED
Binary file
|
data/us2.png
ADDED
Binary file
|
data/us3.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: userswitch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- matija
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,10 +67,16 @@ files:
|
|
67
67
|
- LICENSE.txt
|
68
68
|
- README.md
|
69
69
|
- Rakefile
|
70
|
+
- app/controllers/userswitch/switch_controller.rb
|
70
71
|
- bin/console
|
71
72
|
- bin/setup
|
73
|
+
- config/routes.rb
|
72
74
|
- lib/userswitch.rb
|
75
|
+
- lib/userswitch/engine.rb
|
73
76
|
- lib/userswitch/version.rb
|
77
|
+
- us1.png
|
78
|
+
- us2.png
|
79
|
+
- us3.png
|
74
80
|
- userswitch.gemspec
|
75
81
|
homepage: https://github.com/kodius/userswitch
|
76
82
|
licenses:
|
@@ -93,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
99
|
version: '0'
|
94
100
|
requirements: []
|
95
101
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
102
|
+
rubygems_version: 2.4.5.2
|
97
103
|
signing_key:
|
98
104
|
specification_version: 4
|
99
105
|
summary: Switch between various user roles on your Rails app.
|