Skip to content

Commit

Permalink
bringing back the save feature
Browse files Browse the repository at this point in the history
  • Loading branch information
aziz committed Feb 24, 2014
1 parent ea09941 commit f2ae23b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
11 changes: 4 additions & 7 deletions TODO.todo
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
TODO v.0.7:
☐ BUG: save does not work (gallery/local/external)
☐ slide animation is not smooth
☐ add more themes
☐ more lang support (PHP Perl GO LESS SCSS C C++ Lua XML Markdown Latex)

Preview and scope bar:
☐ do not scroll preview when popover is open on the preview code
☐ refactor scopebar

Refactor:
☐ refactor routing
☐ refactor scopebar

Performance:
☐ cache gallery, color-schemes and file samples locally to boost speed (https://github.com/jmdobry/angular-cache)
Expand All @@ -25,6 +19,8 @@ BackEnds:
☐ https://developers.goinstant.com/v1/GoAngular/index.html

TODO:
☐ add more themes
☐ more lang support (PHP Perl GO LESS SCSS C C++ Lua XML Markdown Latex)
☐ confirm delete local themes
☐ rss feed for gallery
☐ contrast score for bg and fg https://github.com/LeaVerou/contrast-ratio
Expand Down Expand Up @@ -136,6 +132,7 @@ Test:
☐ download theme
___________________
Archive:
✔ BUG: save does not work (gallery/local/external) @done (14-02-24 10:42) @project(TODO v.0.7)
✔ BUG: back when galerry is closed -> badly posisioned throbber @done (14-02-24 10:04)
✔ gutter issue (redo gutter styling) @done (14-02-24 09:48) @project(Preview and scope bar)
✔ dynamically set pre width based on longest line @done (14-02-24 09:48) @project(Preview and scope bar)
Expand Down
8 changes: 7 additions & 1 deletion app/assets/js/controllers/editor_controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,14 @@ Application.controller 'editorController',

# -- SAVE ---------------------------------------------------

# TODO: this is broken
$scope.save_theme = ->
return unless Theme.json
if Theme.type == 'Local File'
FileManager.save($scope.selected_theme, Theme.to_plist())
else
# save a local copy of current theme
FileManager.add_from_memory($scope.selected_theme, Theme.to_plist())
$location.path("/local/#{$scope.selected_theme}")

# -- ROUTING ----------------------------------------------
# TODO: make this a proper angular routing
Expand Down
10 changes: 10 additions & 0 deletions app/assets/js/services/file_manager_service.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ Application.factory "FileManager", ['$q', ($q) ->
localStorage.setItem("local_files", angular.toJson(@list))
file_names

add_from_memory = (file_name, content) ->
@list.push({name: file_name})
localStorage.setItem("local_files", angular.toJson(@list))
@save(file_name, content)

save = (file_name, content) ->
localStorage.setItem("THEME/#{file_name}", content)

remove = (file) ->
@list.remove(file)
localStorage.setItem("local_files", angular.toJson(@list))
Expand All @@ -34,6 +42,8 @@ Application.factory "FileManager", ['$q', ($q) ->
list: list
add: add
load: load
save: save
remove: remove
add_from_memory: add_from_memory
}
]
3 changes: 3 additions & 0 deletions app/assets/js/services/theme_service.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Application.factory "Theme", ['Color', 'json_to_plist', 'plist_to_json', (Color,
blob = new Blob([plist], {type: 'text/plain'})
saveAs blob, "#{@json.name}.tmTheme"

to_plist = -> json_to_plist(@json)

# Theme Stylesheet Generator ------------------------------------------

css_scopes = ->
Expand Down Expand Up @@ -101,6 +103,7 @@ Application.factory "Theme", ['Color', 'json_to_plist', 'plist_to_json', (Color,
{
process: process
download: download
to_plist: to_plist
xml: xml
json: json
type: type
Expand Down

0 comments on commit f2ae23b

Please sign in to comment.