serpscan-dashboard 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f7461b25e9503c2542061452480898d682e13f16
4
+ data.tar.gz: 15134f1eb12b90ec773961c34fc5606fbfe26cee
5
+ SHA512:
6
+ metadata.gz: 0fc899a9b2ce9e2af296cf93bfd72581f122fe48e796b96e93ba185cef0f06873ff9c6ed2c4a8c5cef92383466caf82ea9cfc57eb2715358f19c160c67816c00
7
+ data.tar.gz: 15457e69ed89751391f4bf22d91891a315b805fe810efd37be570874906ab6060b39a80810b5e48fa6cf61b45a8c3a896e38e08619568b57d2cda360e4ca78b7
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 Dylan Montgomery
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/Rakefile ADDED
@@ -0,0 +1,26 @@
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 = 'Serpscan::Dashboard'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/test_app/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
@@ -0,0 +1,31 @@
1
+ module Serpscan
2
+ module Dashboard
3
+ class KeywordsController < ActionController::Base
4
+
5
+ def create
6
+ @website = Serpscan::Website.find(params[:id])
7
+
8
+ if params[:keyword].present?
9
+ @website.create_keyword(params[:keyword])
10
+ flash[:success] = "Keyword successfully created"
11
+ else
12
+ flash[:error] = "Please provide a keyword"
13
+ end
14
+
15
+ redirect_to :back
16
+ end
17
+
18
+ def delete
19
+ if params[:ids].present?
20
+ ids = params[:ids].split(',')
21
+ ids.map { |id| Serpscan::Keyword.find(id).delete }
22
+ flash[:success] = "Keyword successfully deleted"
23
+ else
24
+ flash[:error] = "Please select a keyword to delete"
25
+ end
26
+
27
+ redirect_to :back
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,21 @@
1
+ module Serpscan
2
+ module Dashboard
3
+ class WebsitesController < ActionController::Base
4
+ layout 'serpscan/dashboard'
5
+
6
+ def index
7
+ @websites = Serpscan::Website.all
8
+
9
+ if @websites.count.eql?(1)
10
+ redirect_to "serpscan/#{@websites[0].id}"
11
+ end
12
+ end
13
+
14
+ def show
15
+ @website = Serpscan::Website.find(params[:id])
16
+ @keywords = @website.keywords
17
+ @attributes = [:phrase, :current_rank, :day_change, :month_change, :alltime_change]
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Serpscan Dashboard</title>
5
+ <%= csrf_meta_tags %>
6
+ <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
7
+ <!-- Latest compiled and minified JavaScript -->
8
+
9
+ <!-- Latest compiled and minified CSS -->
10
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
11
+
12
+ <!-- Optional theme -->
13
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
14
+
15
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
16
+
17
+ <!-- Latest compiled and minified CSS -->
18
+ <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.7.0/bootstrap-table.min.css">
19
+
20
+ <!-- Latest compiled and minified JavaScript -->
21
+ <script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.7.0/bootstrap-table.min.js"></script>
22
+ </head>
23
+ <body>
24
+ <div class="container">
25
+ <%= yield %>
26
+ </div>
27
+ </body>
28
+ </html>
@@ -0,0 +1,16 @@
1
+ <h1>SERP Scan</h1>
2
+
3
+ <table data-toggle="table" data-pagination="true" data-page-size="50" data-sort-name="url" data-sort-order="desc" data-toolbar="#create-keyword" data-search="true" class="table-striped">
4
+ <thead>
5
+ <tr>
6
+ <th data-field="url" data-sortable="true">URL</th>
7
+ </tr>
8
+ </thead>
9
+ <tbody>
10
+ <% @websites.each do |website| %>
11
+ <tr>
12
+ <td><%= link_to website.url, serpscan_dashboard.website_path(website.id) %></td>
13
+ </tr>
14
+ <% end %>
15
+ </tbody>
16
+ </table>
@@ -0,0 +1,159 @@
1
+ <style>
2
+ .fader {
3
+ opacity: 0;
4
+ display: none;
5
+ -webkit-transition: opacity 0.15s linear;
6
+ -moz-transition: opacity 0.15s linear;
7
+ -o-transition: opacity 0.15s linear;
8
+ transition: opacity 0.15s linear;
9
+ }
10
+ .fader.in {
11
+ opacity: 1;
12
+ display: block;
13
+ }
14
+ </style>
15
+
16
+ <h1><%= @website.url %></h1>
17
+ <% if flash[:success] %><div class="bg-success fader in" style="padding:5px 5px"><h5><%= flash[:success] %></h5></div><% end %>
18
+ <% if flash[:error] %><div class="bg-warning fader in" style="padding:5px 5px"><h5><%= flash[:error] %></h5></div><% end %>
19
+
20
+ <div>
21
+ <table id="table" data-pagination="true" data-page-size="50" data-sort-name="name" data-sort-order="desc" data-toolbar="#create-keyword" data-show-refresh="false" data-show-columns="true" data-search="true" class="table-striped">
22
+ <thead>
23
+ <tr>
24
+ <th></th>
25
+ <% @attributes.each do |attribute| %>
26
+ <th data-field="<%= attribute %>" data-sortable="true"><%= attribute.to_s.humanize %></th>
27
+ <% end %>
28
+ </tr>
29
+ </thead>
30
+ <tbody>
31
+ <% @keywords.each do |keyword| %>
32
+ <tr data-index="<%= keyword.id %>">
33
+
34
+ <td class="bs-checkbox" data-index="<%= keyword.id %>"><input data-index='' data-id="<%= keyword.id %>" name="keyword" type="checkbox"></td>
35
+
36
+
37
+ <% @attributes.each do |attribute| %>
38
+ <td><%= keyword.send(attribute) %></td>
39
+ <% end %>
40
+ </tr>
41
+ <% end %>
42
+ </tbody>
43
+ </table>
44
+ </div>
45
+ </div>
46
+
47
+
48
+
49
+ <script>
50
+ $( document ).ready(function() {
51
+
52
+ $(document).on('change', 'input:checkbox', function() {
53
+ if($('input[type="checkbox"][name="keyword"]:checked').val()) {
54
+ $('#delete-keyword-button').attr('disabled', false);
55
+ } else {
56
+ $('#delete-keyword-button').attr('disabled', true);
57
+ }
58
+ });
59
+
60
+ $('#refresh-button').on('click', function(){
61
+ window.location.reload();
62
+ })
63
+
64
+
65
+ $(function () {
66
+ $('#table').bootstrapTable({
67
+ // data: data
68
+ });
69
+ });
70
+
71
+ function hideAlert() {
72
+ $(".fader.in").removeClass("in");
73
+ }
74
+
75
+ window.setTimeout(function () {
76
+ hideAlert();
77
+ }, 5000);
78
+
79
+
80
+ function selectedIds() {
81
+ return $('input[type="checkbox"][name="keyword"]:checked').map(function(){
82
+ return $(this).data('id');
83
+ }).get();
84
+ }
85
+
86
+ function deleteURL(){
87
+ return '/serpscan/keywords/delete?ids=' + selectedIds()
88
+ }
89
+
90
+ $('#confirm-delete').on('show.bs.modal', function(e) {
91
+
92
+
93
+ var deleteLink = $(e.relatedTarget).data('href') + '?ids=' + selectedIds;
94
+ $(document).find('#confirm-delete .btn-ok').attr('href', deleteLink);
95
+ });
96
+
97
+ $('#confirm-delete .btn-ok').on('click', function(){
98
+ $(document).find('#confirm-delete .btn-ok').attr('href', deleteURL);
99
+ });
100
+ });
101
+
102
+ </script>
103
+
104
+
105
+ <div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
106
+ <div class="modal-dialog">
107
+ <div class="modal-content">
108
+ <div class="modal-header">
109
+ <h4 class="modal-title" id="exampleModalLabel">Delete selected keywords?</h4>
110
+ </div>
111
+ <div class="modal-body">
112
+ All ranking history will be lost.
113
+ </div>
114
+ <div class="modal-footer">
115
+ <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
116
+ <a class="btn btn-danger btn-ok">Delete</a>
117
+ </div>
118
+ </div>
119
+ </div>
120
+ </div>
121
+
122
+ <div id="create-keyword">
123
+ <button type="button" class="btn btn-default" data-toggle="modal" data-target="#exampleModal">
124
+ <i class="glyphicon glyphicon-plus"></i>
125
+ </button>
126
+
127
+ <button type="button" class="btn btn-default" id="delete-keyword-button" data-toggle="modal" data-target="#confirm-delete" disabled>
128
+ <i class="glyphicon glyphicon-minus"></i>
129
+ </button>
130
+
131
+ <button type="button" class="btn btn-default" id="refresh-button">
132
+ <i class="glyphicon glyphicon-refresh"></i>
133
+ </button>
134
+ </div>
135
+
136
+ <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
137
+ <div class="modal-dialog">
138
+ <div class="modal-content">
139
+ <div class="modal-header">
140
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
141
+ <h4 class="modal-title" id="exampleModalLabel">New Keyword</h4>
142
+ </div>
143
+ <div class="modal-body">
144
+
145
+ <form class="form-inline" action="/serpscan/<%= @website.id %>/keyword" method="post" id="create-keyword" >
146
+ <input type="text" class="form-control" name="keyword" placeholder="Keyword" style="width:100%">
147
+
148
+
149
+
150
+ </div>
151
+ <div class="modal-footer">
152
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
153
+ <button type="submit" class="btn btn-primary">Create</button>
154
+ </div>
155
+ </form>
156
+ </div>
157
+
158
+ </div>
159
+ </div>
data/config/routes.rb ADDED
@@ -0,0 +1,6 @@
1
+ Serpscan::Dashboard::Engine.routes.draw do
2
+ get '/' => 'websites#index', as: :websites
3
+ get '/:id' => 'websites#show', as: :website
4
+ post '/:id/keyword' => 'keywords#create'
5
+ get '/keywords/delete' => 'keywords#delete'
6
+ end
@@ -0,0 +1,7 @@
1
+ module Serpscan
2
+ module Dashboard
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace Serpscan::Dashboard
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Serpscan
2
+ module Dashboard
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ require "rails"
2
+ require "serpscan"
3
+ require "serpscan-dashboard/engine"
4
+
5
+ module Serpscan
6
+ module Dashboard
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: serpscan-dashboard
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dylan Montgomery
8
+ - Citizens In Space, Inc.
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-05-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">"
19
+ - !ruby/object:Gem::Version
20
+ version: 4.0.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">"
26
+ - !ruby/object:Gem::Version
27
+ version: 4.0.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: serpscan
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 0.1.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.1.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec-rails
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: sqlite3
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ description: Dashboard to track your search engine rankings.
71
+ email:
72
+ - mail@citizensinspace.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - MIT-LICENSE
78
+ - Rakefile
79
+ - app/controllers/serpscan/dashboard/keywords_controller.rb
80
+ - app/controllers/serpscan/dashboard/websites_controller.rb
81
+ - app/views/layouts/serpscan/dashboard.html.erb
82
+ - app/views/serpscan/dashboard/websites/index.html.erb
83
+ - app/views/serpscan/dashboard/websites/show.html.erb
84
+ - config/routes.rb
85
+ - lib/serpscan-dashboard.rb
86
+ - lib/serpscan-dashboard/engine.rb
87
+ - lib/serpscan-dashboard/version.rb
88
+ homepage: http://serpscan.com
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.4.5
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Rails engine to view and manage your SERP Scan account within your own app.
112
+ test_files: []
113
+ has_rdoc: