hstatic 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/res/style.css ADDED
@@ -0,0 +1,8 @@
1
+ .row {
2
+ margin-top: 10px;
3
+ margin-bottom: 10px;
4
+ }
5
+
6
+ .panel-heading button {
7
+ margin-left: 20px;
8
+ }
data/views/index.haml ADDED
@@ -0,0 +1,80 @@
1
+ -# UTF-8:
2
+
3
+ !!! 5
4
+ %html
5
+ %head
6
+ %meta(name="viewport" content="width=device-width, initial-scale=1.0")
7
+
8
+ / Bootstrap
9
+ %link(href="/.res/bootstrap.min.css" rel="stylesheet")
10
+ %link(href="/.res/style.css" rel="stylesheet")
11
+ %script(src="/.res/jquery.min.js" type="text/javascript")
12
+ %body
13
+ %div.container-fluid
14
+ %div.row
15
+ %div.col-md-4.col-md-offset-4
16
+ %input.form-control(type="text" placeholder="Search")
17
+ %div.row
18
+ %div.col-lg-3.col-md-3.col-sm-3
19
+ %div.panel.panel-default
20
+ %div.panel-heading
21
+ Folders
22
+ %a.pull-right(href="#{@parent}")
23
+ %span.glyphicon.glyphicon-arrow-up
24
+ Up
25
+ %div.list-group
26
+ - @folders.each do |folder|
27
+ %a.list-group-item(href="#{folder[:href]}") #{folder[:name]}
28
+
29
+ %div.col-lg-9.col-md-9.col-sm-9
30
+ %div.panel.panel-default
31
+ %div.panel-heading Files
32
+ %table.table.table-hover
33
+ %thead
34
+ %tr
35
+ %th #
36
+ %th Name
37
+ %th Size
38
+ %tbody
39
+ - i = 1
40
+ - @files.each do |file|
41
+ %tr
42
+ %td= i
43
+ %td
44
+ %a(href="#{file[:href]}") #{file[:name]}
45
+ %td= file[:size]
46
+ - i += 1
47
+
48
+ :javascript
49
+ $(document).ready(function () {
50
+ $('input').focus();
51
+ var re = new RegExp;
52
+ /* filtering */
53
+ $('input').on('input', function () {
54
+ value = $(this).val();
55
+ $('a.list-group-item').show();
56
+ $('tr:has(a)').show();
57
+ if (value == "") {
58
+ return false;
59
+ }
60
+ re.compile(value, "i");
61
+ arr1 = $.grep($('a.list-group-item'), function(e, i){
62
+ return ! re.test(e.innerHTML);
63
+ });
64
+ arr2 = $.grep($('tr:has(a)'), function(e, i){
65
+ return ! re.test($('a', e).html());
66
+ });
67
+ arr = arr1.concat(arr2);
68
+ for (i in arr) {
69
+ $(arr[i]).hide();
70
+ }
71
+ });
72
+ $('input').on('keyup', function (event) {
73
+ if (event.which == 27) {
74
+ $('input').val("");
75
+ $('input').trigger('input');
76
+ }
77
+ });
78
+ });
79
+
80
+
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hstatic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Erick Pérez Castellanos
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sinatra
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: haml
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: |-
70
+ Hstatic is a simple HTTP server for your static files.
71
+ It's designed for launching it from anywhere in your filesystem tree.
72
+ It features a nice directory listing and automatic publishing of your index.html files
73
+ email:
74
+ - erick.red@gmail.com
75
+ executables:
76
+ - hstatic
77
+ extensions: []
78
+ extra_rdoc_files: []
79
+ files:
80
+ - .gitignore
81
+ - Gemfile
82
+ - LICENSE.txt
83
+ - README.md
84
+ - Rakefile
85
+ - bin/hstatic
86
+ - hstatic.gemspec
87
+ - lib/hstatic.rb
88
+ - lib/hstatic/app.rb
89
+ - lib/hstatic/version.rb
90
+ - res/bootstrap.min.css
91
+ - res/glyphicons-halflings-regular.eot
92
+ - res/glyphicons-halflings-regular.svg
93
+ - res/glyphicons-halflings-regular.ttf
94
+ - res/glyphicons-halflings-regular.woff
95
+ - res/index.haml
96
+ - res/jquery.min.js
97
+ - res/style.css
98
+ - views/index.haml
99
+ homepage: https://github.com/erick2red/hstatic
100
+ licenses:
101
+ - MIT
102
+ metadata: {}
103
+ post_install_message:
104
+ rdoc_options: []
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ requirements: []
118
+ rubyforge_project:
119
+ rubygems_version: 2.0.3
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: An HTTP server for you static files
123
+ test_files: []