sharkey-web 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.md +19 -0
  5. data/README.md +188 -0
  6. data/Rakefile +8 -0
  7. data/bin/sharkey-web +9 -0
  8. data/config.ru +3 -0
  9. data/lib/sharkey.rb +12 -0
  10. data/lib/sharkey/app.rb +526 -0
  11. data/lib/sharkey/importerexporter.rb +79 -0
  12. data/lib/sharkey/models.rb +295 -0
  13. data/lib/sharkey/public/css/loading.gif +0 -0
  14. data/lib/sharkey/public/css/magicsuggest.css +232 -0
  15. data/lib/sharkey/public/css/nprogress.css +74 -0
  16. data/lib/sharkey/public/css/styles.css +263 -0
  17. data/lib/sharkey/public/css/ui.fancytree.css +545 -0
  18. data/lib/sharkey/public/data/sentences.txt +5 -0
  19. data/lib/sharkey/public/fonts/Quadrata.eot +0 -0
  20. data/lib/sharkey/public/fonts/Quadrata.svg +613 -0
  21. data/lib/sharkey/public/fonts/Quadrata.ttf +0 -0
  22. data/lib/sharkey/public/fonts/Quadrata.woff +0 -0
  23. data/lib/sharkey/public/fonts/Quadrata.zip +0 -0
  24. data/lib/sharkey/public/images/loader.gif +0 -0
  25. data/lib/sharkey/public/images/sharkey-logo.png +0 -0
  26. data/lib/sharkey/public/images/sharkey.png +0 -0
  27. data/lib/sharkey/public/js/ajaxmanager.js +67 -0
  28. data/lib/sharkey/public/js/keybindings.js +92 -0
  29. data/lib/sharkey/public/js/lib/bootstrap.min.js +6 -0
  30. data/lib/sharkey/public/js/lib/jquery-1.9.1.min.js +5 -0
  31. data/lib/sharkey/public/js/lib/jquery-ui.js +16150 -0
  32. data/lib/sharkey/public/js/lib/jquery.bootstrap-autohidingnavbar.js +213 -0
  33. data/lib/sharkey/public/js/lib/jquery.fancytree-all.js +6424 -0
  34. data/lib/sharkey/public/js/lib/jquery.tagcloud.js +92 -0
  35. data/lib/sharkey/public/js/lib/magicsuggest.js +1468 -0
  36. data/lib/sharkey/public/js/lib/mousetrap.min.js +9 -0
  37. data/lib/sharkey/public/js/lib/nprogress.js +476 -0
  38. data/lib/sharkey/public/js/page-add-link-autofill.js +102 -0
  39. data/lib/sharkey/public/js/page-add-link.js +156 -0
  40. data/lib/sharkey/public/js/page-categories.js +348 -0
  41. data/lib/sharkey/public/js/page-edit-link.js +103 -0
  42. data/lib/sharkey/public/js/page-links.js +54 -0
  43. data/lib/sharkey/public/js/page-settings.js +93 -0
  44. data/lib/sharkey/public/js/page-tagcloud.js +35 -0
  45. data/lib/sharkey/public/js/page-tags.js +287 -0
  46. data/lib/sharkey/public/js/scripts.js +147 -0
  47. data/lib/sharkey/public/themes/amelia/style.css +7 -0
  48. data/lib/sharkey/public/themes/bootstrap/style.css +5785 -0
  49. data/lib/sharkey/public/themes/cerulean/style.css +7 -0
  50. data/lib/sharkey/public/themes/cosmo/style.css +7 -0
  51. data/lib/sharkey/public/themes/cyborg/style.css +7 -0
  52. data/lib/sharkey/public/themes/darkly/style.css +7 -0
  53. data/lib/sharkey/public/themes/facebook-like/README.md +6 -0
  54. data/lib/sharkey/public/themes/facebook-like/style.css +6085 -0
  55. data/lib/sharkey/public/themes/flatly/style.css +7 -0
  56. data/lib/sharkey/public/themes/fonts/glyphicons-halflings-regular.eot +0 -0
  57. data/lib/sharkey/public/themes/fonts/glyphicons-halflings-regular.svg +229 -0
  58. data/lib/sharkey/public/themes/fonts/glyphicons-halflings-regular.ttf +0 -0
  59. data/lib/sharkey/public/themes/fonts/glyphicons-halflings-regular.woff +0 -0
  60. data/lib/sharkey/public/themes/holo-like/README.md +5 -0
  61. data/lib/sharkey/public/themes/holo-like/style.css +5997 -0
  62. data/lib/sharkey/public/themes/journal/style.css +7 -0
  63. data/lib/sharkey/public/themes/lumen/style.css +7 -0
  64. data/lib/sharkey/public/themes/readable/style.css +7 -0
  65. data/lib/sharkey/public/themes/simplex/style.css +7 -0
  66. data/lib/sharkey/public/themes/slate/style.css +7 -0
  67. data/lib/sharkey/public/themes/spacelab/style.css +7 -0
  68. data/lib/sharkey/public/themes/superhero/style.css +7 -0
  69. data/lib/sharkey/public/themes/united/style.css +7 -0
  70. data/lib/sharkey/public/themes/yeti/style.css +7 -0
  71. data/lib/sharkey/setting.rb +74 -0
  72. data/lib/sharkey/version.rb +5 -0
  73. data/lib/sharkey/views/404.slim +4 -0
  74. data/lib/sharkey/views/about.slim +7 -0
  75. data/lib/sharkey/views/add_link.slim +157 -0
  76. data/lib/sharkey/views/categories.slim +101 -0
  77. data/lib/sharkey/views/category.slim +22 -0
  78. data/lib/sharkey/views/centered.slim +49 -0
  79. data/lib/sharkey/views/dashboard.slim +107 -0
  80. data/lib/sharkey/views/dashboard_index.slim +26 -0
  81. data/lib/sharkey/views/edit_link.slim +121 -0
  82. data/lib/sharkey/views/help.slim +74 -0
  83. data/lib/sharkey/views/keybindings.slim +58 -0
  84. data/lib/sharkey/views/link.slim +30 -0
  85. data/lib/sharkey/views/links.slim +22 -0
  86. data/lib/sharkey/views/navbar.slim +68 -0
  87. data/lib/sharkey/views/settings.slim +74 -0
  88. data/lib/sharkey/views/settings_index.slim +220 -0
  89. data/lib/sharkey/views/single_category.slim +37 -0
  90. data/lib/sharkey/views/single_link.slim +95 -0
  91. data/lib/sharkey/views/single_tag.slim +33 -0
  92. data/lib/sharkey/views/tag.slim +22 -0
  93. data/lib/sharkey/views/tagcloud.slim +54 -0
  94. data/lib/sharkey/views/tags.slim +99 -0
  95. data/sharkey-web.gemspec +44 -0
  96. metadata +324 -0
@@ -0,0 +1,49 @@
1
+ / Layout for simple, centered information
2
+ doctype html
3
+ html
4
+ head
5
+ meta charset="utf-8"
6
+ title Sharkey
7
+
8
+ / Bootstrap
9
+ (Poor Man's Theme Support)
10
+ link[
11
+ rel="stylesheet" media="screen, projection"
12
+ href="/themes/#{Sharkey::Setting['theme']}/style.css"
13
+ ]
14
+
15
+ / Misc. Styles
16
+ - if Sharkey::Setting['loading_bar'] == 'true'
17
+ link rel="stylesheet" href="/css/nprogress.css"
18
+
19
+ link rel="stylesheet" href="/css/magicsuggest.css"
20
+
21
+ / Custom Styles
22
+ link rel="stylesheet" media="screen, projection" href="/css/styles.css"
23
+
24
+ /[if lt IE 9]
25
+ script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"
26
+
27
+ / jQuery
28
+ script src="/js/lib/jquery-1.9.1.min.js"
29
+ script src="/js/lib/jquery-ui.js"
30
+
31
+ / Bootstrap
32
+ script src="/js/lib/bootstrap.min.js"
33
+
34
+ / Misc. Scripts
35
+ - if Sharkey::Setting['loading_bar'] == 'true'
36
+ script src="/js/lib/nprogress.js"
37
+
38
+ / Custom Scripts
39
+ script src="/js/scripts.js"
40
+
41
+ body
42
+ == slim(:navbar, locals: { page: page })
43
+
44
+ .container-fluid
45
+ .row
46
+ / The actual content
47
+ .col-md-8.col-sm-offset-2.main
48
+ == yield
49
+
@@ -0,0 +1,107 @@
1
+ /
2
+ Layout for the main dashboard
3
+
4
+ doctype html
5
+ html
6
+ head
7
+ meta charset="utf-8"
8
+
9
+ /!
10
+ .
11
+ mmm mmm m mm m m mmmmm mmm m mm
12
+ # ' ' # #' ' # # # # # ' # #' #
13
+ '''m m'''# # # # # # # m'''# # #
14
+ 'mmm' 'mm'# # 'mm'# # # # 'mm'# # #
15
+ sharkey link: the best thing since Delicious
16
+ .
17
+
18
+ title Sharkey
19
+
20
+ / Bootstrap
21
+ (Poor Man's Theme Support)
22
+ link[
23
+ rel="stylesheet" media="screen, projection"
24
+ href="/themes/#{Sharkey::Setting['theme']}/style.css"
25
+ ]
26
+
27
+ / Misc. Styles
28
+ - if Sharkey::Setting['loading_bar'] == 'true'
29
+ link rel="stylesheet" href="/css/nprogress.css"
30
+
31
+ link rel="stylesheet" href="/css/magicsuggest.css"
32
+ link rel="stylesheet" href="/css/ui.fancytree.css"
33
+
34
+ / Custom Styles
35
+ link rel="stylesheet" media="screen, projection" href="/css/styles.css"
36
+
37
+ /[if lt IE 9]
38
+ script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"
39
+
40
+ / jQuery
41
+ script src="/js/lib/jquery-1.9.1.min.js"
42
+ script src="/js/lib/jquery-ui.js"
43
+
44
+ / Bootstrap
45
+ script src="/js/lib/bootstrap.min.js"
46
+
47
+ / Misc. Scripts
48
+ - if Sharkey::Setting['loading_bar'] == 'true'
49
+ script src="/js/lib/nprogress.js"
50
+
51
+ / Custom Scripts
52
+ script src="/js/scripts.js"
53
+
54
+ body
55
+ == slim(:navbar, locals: { page: page })
56
+
57
+ .container-fluid
58
+ .row
59
+
60
+ / The sidebar
61
+ .col-sm-3.col-md-2.sidebar#the-sidebar
62
+ ul.nav.nav-sidebar
63
+ li class="#{ if page == 'home' then 'active' end }"
64
+ a href="/"
65
+ span> class="glyphicon glyphicon-tasks"
66
+ | Dashboard
67
+
68
+ ul.nav.nav-sidebar
69
+ li class="#{ if page == 'links' then 'active' end }"
70
+ a#keybind-links href="/links"
71
+ span> class="glyphicon glyphicon-link"
72
+ | Links
73
+ span.badge.pull-right = Sharkey::Link.all.size
74
+ li class="#{ if page == 'favorites' then 'active' end }"
75
+ a#keybind-favorites href="/favorites"
76
+ span> class="glyphicon glyphicon-star"
77
+ | Favorites
78
+ span.badge.pull-right = Sharkey::Link.all(favorite: true).size
79
+
80
+ li
81
+ a href="/random"
82
+ span> class="glyphicon glyphicon-random"
83
+ | Random Link
84
+
85
+ ul.nav.nav-sidebar
86
+ li class="#{ if page == 'tags' then 'active' end }"
87
+ a#keybind-tags href="/tags"
88
+ span> class="glyphicon glyphicon-tags"
89
+ | Tags
90
+ span.badge.pull-right = Sharkey::Tag.all.size
91
+
92
+ li class="#{ if page == 'tagcloud' then 'active' end }"
93
+ a#keybind-tags href="/tagcloud"
94
+ span> class="glyphicon glyphicon-cloud"
95
+ | Tag Cloud
96
+
97
+ ul.nav.nav-sidebar
98
+ li class="#{ if page == 'categories' then 'active' end }"
99
+ a#keybind-categories href="/categories"
100
+ span> class="glyphicon glyphicon-book"
101
+ | Categories
102
+ span.badge.pull-right = Sharkey::Category.all.size
103
+
104
+ / The actual content
105
+ .col-sm-9.col-sm-offset-3.col-md-10.col-md-offset-2.main
106
+ == yield
107
+
@@ -0,0 +1,26 @@
1
+ /
2
+ The main Page
3
+
4
+ h1.page-header Dashboard
5
+
6
+ p Welcome to Sharkey Link!
7
+
8
+ p You have...
9
+
10
+ ul
11
+ - if Sharkey::Link.all.size == 0
12
+ li no links;
13
+ - else
14
+ li #{Sharkey::Link.all.size} links;
15
+
16
+ - if Sharkey::Tag.all.size == 0
17
+ li no tags;
18
+ - else
19
+ li #{Sharkey::Tag.all.size} tags;
20
+
21
+ h2.sub-header Awesome!
22
+
23
+ p Sweet, beibeh!
24
+
25
+ p [insert awesome statistics here]
26
+
@@ -0,0 +1,121 @@
1
+ / The 'Edit Button' dialog
2
+ It will only get shown when requested by a button
3
+ Expects a local variable `link` with a.. link.
4
+
5
+ .modal.fade.input-link#edit-link tabindex="-1" role="dialog" aria-labelledby="input-link-label" aria-hidden="true"
6
+ .modal-dialog
7
+ .modal-content
8
+ .modal-header
9
+ button.close type="button" data-dismiss="modal" aria-hidden="true"
10
+ | ×
11
+
12
+ h4.modal-title.input-link-label
13
+ | Edit link
14
+
15
+ p.random-sentence
16
+ | ...#{random_sentence}
17
+
18
+ .modal-body
19
+ / Form that creates a Link
20
+ It's 'action' will get changed by the JavaScript
21
+ to conform to the API like '/update/link/:id'
22
+ form.form-horizontal role="form" action="/update/link" method="POST"
23
+
24
+ .form-group
25
+ label.col-sm-2.control-label for="input-link-url"
26
+ | URL
27
+ .col-sm-10
28
+ input.form-control type="text" id="input-link-url" name="url" placeholder="URL" required="true" autofocus="true"
29
+
30
+ .form-group
31
+ .col-sm-offset-2.col-sm-10
32
+ button.btn.btn-primary type="submit"
33
+ span.glyphicon.glyphicon-flash
34
+ '
35
+ | Edit link
36
+
37
+ .form-group
38
+ label.col-sm-2.control-label for="input-link-title"
39
+ | Title
40
+ .col-sm-10
41
+ input.form-control type="text" id="input-link-title" name="title" placeholder="title"
42
+
43
+ .form-group
44
+ label.col-sm-2.control-label for="input-link-tags"
45
+ | Tags
46
+ .col-sm-10
47
+ input.form-control.tagsinput type="text" id="input-link-tags" name="tags" placeholder="tag (comma-separated)"
48
+
49
+ .form-group
50
+ label.col-sm-2.control-label for="input-links-url"
51
+ | Comments
52
+ .col-sm-10
53
+ textarea.form-control[
54
+ type="textarea"
55
+ id="input-link-comment"
56
+ name="comment"
57
+ placeholder="express yourself"
58
+ ]
59
+
60
+ .form-group
61
+ label.col-sm-2.control-label for="input-link-category-one"
62
+ | Category
63
+ .col-sm-10
64
+ select.form-control id="input-link-category-one" name="category" placeholder="Category"
65
+ ruby:
66
+ # This magic function shows all Categories in
67
+ # hierarchical order. Just like:
68
+ #
69
+ # parent
70
+ # - child
71
+ # - other_child
72
+ # - - other_other_child
73
+ # other_parent
74
+ # - another_child
75
+
76
+ def select_options
77
+ $output = "<option value=''>(none)</option>"
78
+
79
+ def recursive_childs(count, category)
80
+ $output << "<option value='#{category.id}'>#{'- ' * count}#{category.name}</option>"
81
+
82
+ category.childs.each do |child|
83
+ recursive_childs(count + 1, child)
84
+ end
85
+ end
86
+
87
+ Sharkey::Category.orphans.each do |orphan|
88
+ recursive_childs(0, orphan)
89
+ end
90
+ return $output
91
+ end
92
+
93
+ == select_options
94
+
95
+ .col-sm-offset-2.col-sm-10
96
+ button.btn.btn-default.new-category
97
+ span> class="glyphicon glyphicon-book"
98
+ | New Category
99
+
100
+ form.form-horizontal.new-category-form role="form" action="/category" method="POST"
101
+ .form-group
102
+
103
+ label.col-sm-2.control-label for="new-category-name"
104
+ | Name
105
+ .col-sm-10
106
+ input.form-control.new-category-name type="text" name="name" placeholder="New category name" required="true" autofocus="true"
107
+
108
+ label.col-sm-2.control-label for="new-category-parent"
109
+ | Parent
110
+ .col-sm-10
111
+ select.form-control.new-category-parent name="parent" placeholder="Parent"
112
+ == select_options
113
+
114
+ button.btn.btn-default.new-category-button type="submit"
115
+ span> class="glyphicon glyphicon-book"
116
+ | Create Category
117
+
118
+ / If you ever want to add a footer some day,
119
+ just uncomment these two lines
120
+ .modal-footer
121
+
@@ -0,0 +1,74 @@
1
+ h1.page-header
2
+ | Help
3
+
4
+ markdown:
5
+ Welcome to `sharkey` help!
6
+ For info on it's creation and contact, see the _About_ section.
7
+
8
+ h2.sub-header
9
+ | Intro
10
+
11
+ markdown:
12
+ `sharkey` is a cute web-based personal bookmarking service.
13
+
14
+ * **Bookmarking** means it _saves your links_, allows you to _tag them_, arrange
15
+ in _categories_ and, most important of all, _keep track of what you should visit later_.
16
+ * **Personal** means _you control your own data_. Everything is stored on your
17
+ computer and _you can import/export/delete as you please_. It is like the anti-social
18
+ cousin of [Delicious][delicious].
19
+ * **Web-based** means it runs on your browser. _You don't need an internet connection_,
20
+ though! It doesn't mean you access a site to use it - it runs on _your computer_.
21
+ It just happens that I prefer to make sites instead of designing windows and buttons
22
+ and stuff.
23
+ * **Cute** means it has a nice appearance. It comes with _lots of themes_ and you can
24
+ even customize it _with your own themes_ too.
25
+
26
+ h2.sub-header
27
+ | Example
28
+
29
+ markdown:
30
+ If you're unsure on how to start using `sharkey`, here's how I do it.
31
+
32
+ I have lots of tabs opened in my browser. Some of them has sites I want to see later,
33
+ others are just there because... well, I might need them some day.
34
+
35
+ So I start organizing them. I create some tags and categories, placing links
36
+ more or less like the following:
37
+
38
+ table.table.table-hover
39
+ thead
40
+ tr
41
+ th site
42
+ th category
43
+ th tags
44
+ tbody
45
+ tr
46
+ td a youtube video I can't see right now
47
+ td Video > Youtube
48
+ td watch-later
49
+ tr
50
+ td funny images I might link to some friends later
51
+ td Images > Funny
52
+ td link-later
53
+ tr
54
+ td news site I visit regularly
55
+ td News
56
+ td daily
57
+ tr
58
+ td page with important download link
59
+ td Download > Image/Video/Document
60
+ td download-later, important
61
+ tr
62
+ td great online game I recently discovered (and might link to friends later)
63
+ td Game > Online
64
+ td game-later, link-later
65
+
66
+ markdown:
67
+ So, in general, _tags are for quick finding things_ and _categories are
68
+ for organized classifying_.
69
+
70
+ Since `sharkey` has a [Tag Cloud](/tagcloud), it becomes easy to find, say,
71
+ sites I need to visit daily or important things I must see later.
72
+
73
+ And on the [Categories Page](/categories), they're listed like folders on the computer,
74
+ just how Firefox or Chrome displays it's bookmarks.
@@ -0,0 +1,58 @@
1
+
2
+ / Helper that shows the Keybindings
3
+ .modal.fade#keybindings tabindex="-1" role="dialog" aria-labelledby="keybinding-label" aria-hidden="true"
4
+ .modal-dialog
5
+ .modal-content
6
+ .modal-header
7
+ button.close type="button" data-dismiss="modal" aria-hidden="true"
8
+ | &times;
9
+ h3.modal-title#input-link-label
10
+ | Key Bindings
11
+
12
+ .modal-body
13
+
14
+ table.table.table-striped.table-hover
15
+ thead
16
+ tr
17
+ th key
18
+ th action
19
+ tbody
20
+ tr
21
+ td
22
+ kbd a
23
+ td Add single Link
24
+ tr
25
+ td
26
+ kbd m
27
+ td Add multiple Links
28
+ tr
29
+ td
30
+ kbd d
31
+ td Go to the Dashboard
32
+ tr
33
+ td
34
+ kbd s
35
+ td Go to Settings
36
+ tr
37
+ td
38
+ kbd h
39
+ td Show Help
40
+ tr
41
+ td
42
+ kbd l
43
+ td Show Links
44
+ tr
45
+ td
46
+ kbd t
47
+ td Show Tags
48
+ tr
49
+ td
50
+ kbd c
51
+ td Show Categories
52
+ tr
53
+ td
54
+ kbd k
55
+ td Show this window
56
+
57
+
58
+
@@ -0,0 +1,30 @@
1
+ /
2
+ Layout for a page of a single Link
3
+
4
+ == slim(:navbar, locals: { page: "link" })
5
+
6
+ .col-md.12
7
+ .container
8
+
9
+ - if link.title
10
+ h1 Title: #{link.title}
11
+ h2
12
+ a href="#{link.url}" target="_blank"
13
+ | URL: #{link.url}
14
+
15
+ - else
16
+ h1
17
+ a href="#{link.url}" target="_blank"
18
+ | Title: #{link.url}
19
+
20
+ - if link.tags.empty?
21
+ p
22
+ em No Tags
23
+
24
+ - else
25
+ p Tags:
26
+
27
+ - link.tags.each do |tag|
28
+ a.link-tag href="/tag/#{tag.id}" title="#{tag.name}"
29
+ span.badge = tag.name
30
+