daftos 0.4.0 → 0.4.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.
@@ -1,12 +1,14 @@
1
1
  = daftos
2
2
 
3
- Daftos is a server running HTML5 application, providing them your local filesystem via API.
3
+ DaftOS is a server running HTML5 application, providing them your local filesystem via API.
4
+
5
+ DaftOS currently support only UNIX like systems.
4
6
 
5
7
  ==Installation
6
8
 
7
9
  * Download ruby version >= 1.9.0
8
- * gem install daftos
9
- * daft start
10
+ * run <code>gem install daftos</code> in your terminal
11
+ * run <code>daft start</code> in your terminal
10
12
  * point your browser at http://localhost:9999
11
13
 
12
14
  == Contributing to daftos
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
data/bin/daft CHANGED
File without changes
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "daftos"
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ondrej Odchazel"]
@@ -61,6 +61,7 @@ Gem::Specification.new do |s|
61
61
  "lib/apps/photobrowser/.DS_Store",
62
62
  "lib/apps/photobrowser/body.html",
63
63
  "lib/apps/photobrowser/coffee/photobrowser.coffee",
64
+ "lib/apps/photobrowser/css/style.css",
64
65
  "lib/apps/photobrowser/js/.DS_Store",
65
66
  "lib/apps/photobrowser/options.json",
66
67
  "lib/apps/photobrowser/png/.DS_Store",
@@ -330,6 +331,7 @@ Gem::Specification.new do |s|
330
331
  "lib/apps/texteditor/js/worker-javascript.js",
331
332
  "lib/apps/texteditor/js/worker-json.js",
332
333
  "lib/apps/texteditor/options.json",
334
+ "lib/apps/texteditor/png/.DS_Store",
333
335
  "lib/apps/texteditor/png/icon.png",
334
336
  "lib/daftos.rb",
335
337
  "lib/daftos/.DS_Store",
@@ -64,7 +64,7 @@ class FileSystem
64
64
  ret[:client_mtime] = file.mtime
65
65
  ret[:modified] = file.ctime
66
66
  ret[:mime_type] = Rack::Mime.mime_type("." + file.path.split('.').last)
67
- ret[:binary] = File.binary?(ret[:absolute_path])
67
+ #ret[:binary] = File.binary?(ret[:absolute_path])
68
68
  ret
69
69
  end
70
70
 
@@ -20,7 +20,7 @@
20
20
  </li>
21
21
  <li><a href="#/Users/ondrejodchazel">Home</a></li>
22
22
  <li><a href="#/Users/ondrejodchazel/Documents">Documents</a></li>
23
- <li><a href="#">Home</a></li>
23
+ <li><a href="#/Users/ondrejodchazel/Pictures">Pictures</a></li>
24
24
  </ul>
25
25
  </div>
26
26
  </div>
@@ -1,2 +1,5 @@
1
+ <center>
2
+ <h3><span id="filename"></span><small> (<span id="dirposition"></span> of <span id="dirsum"></span>)</small></h3>
3
+ <img src="" id="image">
1
4
 
2
- <img src="" id="image">
5
+ </center>
@@ -7,12 +7,77 @@ $ ->
7
7
 
8
8
  class PhotoBrowser
9
9
  constructor: ->
10
+ @image_path_list = []
11
+ @actual_filename = false
12
+ @actual_dir = false
13
+ @bind_events()
14
+
15
+ bind_events: =>
16
+ $(window).keydown(
17
+ (event) =>
18
+ switch event.keyCode
19
+ when 37 then @prev()
20
+ when 39 then @next()
21
+ )
22
+
23
+ prev: =>
24
+ position = @position_in_dir()
25
+ return if position == false
26
+ position -= 1
27
+ position = @image_path_list.length - 1 unless position >= 0
28
+ location.hash = "#{@image_path_list[position]}"
29
+ @hashchange()
30
+
31
+ next: =>
32
+ position = @position_in_dir()
33
+ return if position == false
34
+ position += 1
35
+ position = position % @image_path_list.length
36
+ location.hash = "#{@image_path_list[position]}"
37
+ @hashchange()
38
+
39
+ dirname: (filepath) =>
40
+ filepath.replace(/[^/]+$/,"")
41
+
42
+ load_image_list: (dirpath) =>
43
+ if @actual_dir == dirpath
44
+ @reload_status_bar()
45
+ return
46
+ @actual_dir = dirpath
47
+ $.ajax '/api/file_system/metadata'
48
+ data:
49
+ path: dirpath
50
+ dataType: 'json'
51
+ success: (data) =>
52
+ @image_path_list = []
53
+ for file in data.contents
54
+ @image_path_list.push(file.absolute_path) if file.mime_type and file.mime_type.match("image/")
55
+ @reload_status_bar()
56
+ error: =>
57
+ alert "Cant load directory #{path}"
58
+
59
+ reload_status_bar: =>
60
+ $("#dirsum").html(@image_path_list.length)
61
+ $("#dirposition").html(@position_in_dir() + 1)
62
+
63
+ position_in_dir: =>
64
+ i = 0
65
+ for name in @image_path_list
66
+ #console.log "#{name} -- #{@actual_filename}"
67
+ return i if name == @actual_filepath
68
+ i += 1
69
+ return false
10
70
 
11
71
  hashchange: =>
12
72
  location = window.location.hash
13
73
  location = location.slice(1,location.length)
14
74
  @load_image(location)
75
+ @load_image_list(@dirname(location))
15
76
 
16
77
  load_image: (path) =>
17
- #/Users/ondrejodchazel/Pictures/pozadi.png
78
+ @actual_filepath = path
79
+ ar = path.split('/')
80
+ @actual_filename = ar[ar.length - 1]
81
+ #console.log @actual_filename
82
+ $("#filename").html(@actual_filename)
18
83
  $("#image").attr("src","/api/file_system/file?path=#{path}")
@@ -0,0 +1,4 @@
1
+ #image {
2
+ max-height: 600px;
3
+ box-shadow: 0px 0px 20px #AAA;
4
+ }
@@ -2,15 +2,7 @@
2
2
  "name": "PhotoBrowser",
3
3
  "description": "Daft photo browser.",
4
4
  "version": "0.1",
5
- "libs": ["bootstrap.css","jquery.js", "daftos.coffee", "bootstrap.js", "photobrowser.coffee"],
6
- "menu": [
7
- {
8
- "name": "Effects",
9
- "id":"iiii",
10
- "submenu": [
11
- {"name":"blur","id":"blur"}
12
- ]
13
- }
14
- ]
5
+ "libs": ["bootstrap.css", "style.css", "jquery.js", "daftos.coffee", "bootstrap.js", "photobrowser.coffee"],
6
+ "menu": []
15
7
  }
16
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daftos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-05-03 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shoulda
16
- requirement: &2177518580 !ruby/object:Gem::Requirement
16
+ requirement: &2166560640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2177518580
24
+ version_requirements: *2166560640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &2177517980 !ruby/object:Gem::Requirement
27
+ requirement: &2166559860 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.12'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2177517980
35
+ version_requirements: *2166559860
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &2177517380 !ruby/object:Gem::Requirement
38
+ requirement: &2166559080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2177517380
46
+ version_requirements: *2166559080
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &2177516780 !ruby/object:Gem::Requirement
49
+ requirement: &2166558180 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.8.3
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2177516780
57
+ version_requirements: *2166558180
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: ptools
60
- requirement: &2177516140 !ruby/object:Gem::Requirement
60
+ requirement: &2166557280 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2177516140
68
+ version_requirements: *2166557280
69
69
  description: Daftos is a server running HTML5 application, providing them your local
70
70
  filesystem via API.
71
71
  email: hypertornado@gmail.com
@@ -119,6 +119,7 @@ files:
119
119
  - lib/apps/photobrowser/.DS_Store
120
120
  - lib/apps/photobrowser/body.html
121
121
  - lib/apps/photobrowser/coffee/photobrowser.coffee
122
+ - lib/apps/photobrowser/css/style.css
122
123
  - lib/apps/photobrowser/js/.DS_Store
123
124
  - lib/apps/photobrowser/options.json
124
125
  - lib/apps/photobrowser/png/.DS_Store
@@ -388,6 +389,7 @@ files:
388
389
  - lib/apps/texteditor/js/worker-javascript.js
389
390
  - lib/apps/texteditor/js/worker-json.js
390
391
  - lib/apps/texteditor/options.json
392
+ - lib/apps/texteditor/png/.DS_Store
391
393
  - lib/apps/texteditor/png/icon.png
392
394
  - lib/daftos.rb
393
395
  - lib/daftos/.DS_Store
@@ -419,7 +421,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
419
421
  version: '0'
420
422
  segments:
421
423
  - 0
422
- hash: -4317224152375089677
424
+ hash: 890507731091816365
423
425
  required_rubygems_version: !ruby/object:Gem::Requirement
424
426
  none: false
425
427
  requirements: