Skip to content

Commit

Permalink
Merge pull request #8 from varvet/feature/locales
Browse files Browse the repository at this point in the history
Adds locales + rubocop
  • Loading branch information
jensljungblad committed Feb 11, 2015
2 parents e7d3c34 + 5168c09 commit 44ac794
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 6 deletions.
17 changes: 17 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
AllCops:
RunRailsCops: true

Documentation:
Enabled: false

Metrics/LineLength:
Max: 120

Metrics/ClassLength:
Max: 300

Metrics/MethodLength:
Max: 25

Style/StringLiterals:
EnforcedStyle: double_quotes
6 changes: 4 additions & 2 deletions app/assets/javascripts/godmin-uploads/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
var $destroyField = $(this).parents(".godmin-upload").find(".godmin-upload-destroy-field");

if ($destroyField.val() === "") {
$(this).find("span").html("Undestroy file");
$(this).find(".godmin-upload-destroy-label").hide();
$(this).find(".godmin-upload-undo-destroy-label").show();
$destroyField.val("true");
} else {
$(this).find("span").html("Destroy file");
$(this).find(".godmin-upload-destroy-label").show();
$(this).find(".godmin-upload-undo-destroy-label").hide();
$destroyField.val("");
}
});
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/godmin-uploads.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
.godmin-upload-file-field {
display: none;
}

.godmin-upload-undo-destroy-label {
display: none;
}
}
7 changes: 4 additions & 3 deletions app/views/godmin/uploads/_uploader.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@
<%= f.label attachment do %>
<span class="btn btn-default godmin-upload-upload-link">
<i class="glyphicon glyphicon-arrow-up"></i>
<span>Upload file</span>
<span><%= t("godmin.uploads.upload_file") %></span>
</span>
<% end %>
<%= f.attachment_field attachment, direct: true, class: "godmin-upload-file-field" %>
<%= f.hidden_field "remove_#{attachment}", class: "godmin-upload-destroy-field" %>
<span class="godmin-upload-buttons <%= "hidden" unless f.object.send(attachment) %>">
<%= link_to attachment_url(f.object, attachment), class: "btn btn-default godmin-upload-download-link" do %>
<i class="glyphicon glyphicon-arrow-down"></i>
<span>Download file</span>
<span><%= t("godmin.uploads.download_file") %></span>
<% end %>
<%= link_to "#", class: "btn btn-danger godmin-upload-destroy-link" do %>
<i class="glyphicon glyphicon-remove"></i>
<span>Destroy file</span>
<span class="godmin-upload-destroy-label"><%= t("godmin.uploads.destroy_file") %></span>
<span class="godmin-upload-undo-destroy-label"><%= t("godmin.uploads.undo_destroy_file") %></span>
<% end %>
</span>
<div class="godmin-upload-progress progress">
Expand Down
7 changes: 7 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
en:
godmin:
uploads:
upload_file: Upload
download_file: Download
destroy_file: Remove
undo_destroy_file: Undo remove
7 changes: 7 additions & 0 deletions config/locales/sv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sv:
godmin:
uploads:
upload_file: Ladda upp
download_file: Ladda ner
destroy_file: Ta bort
undo_destroy_file: Ångra borttagning
2 changes: 1 addition & 1 deletion godmin-uploads.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]

gem.add_dependency "godmin", "~> 0.9.7"
gem.add_dependency "godmin", "~> 0.9", ">= 0.9.7"
gem.add_dependency "refile", "~> 0.5.3"
gem.add_dependency "mini_magick", "~> 4.0.1"

Expand Down

0 comments on commit 44ac794

Please sign in to comment.