diff --git a/.gitignore b/.gitignore index b2406ac..fdff369 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.rbc .bundle .config +.vscode Gemfile.lock .bundle/ log/*.log diff --git a/.travis.yml b/.travis.yml index bd3388f..b7bbb78 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,18 +6,18 @@ rvm: - 2.3.7 - 2.4.4 - 2.5.1 -env: - global: - - QMAKE=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake -addons: - apt: - sources: - - ubuntu-sdk-team - packages: - - libqt5webkit5-dev - - qtdeclarative5-dev +addons: # get google-chrome-stable + chrome: stable +install: # Install ChromeDriver (64bits; replace 64 with 32 for 32bits). + - wget -N https://chromedriver.storage.googleapis.com/2.43/chromedriver_linux64.zip -P ~/ + - unzip ~/chromedriver_linux64.zip -d ~/ + - rm ~/chromedriver_linux64.zip + - sudo mv -f ~/chromedriver /usr/local/share/ + - sudo chmod +x /usr/local/share/chromedriver + - sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver before_install: - gem update --system +- bundle install script: - bin/rails db:migrate - bundle exec rubocop && xvfb-run bundle exec rspec spec diff --git a/app/assets/javascripts/rosetta/application.js b/app/assets/javascripts/rosetta/application.js index 40a99f3..cc97af3 100644 --- a/app/assets/javascripts/rosetta/application.js +++ b/app/assets/javascripts/rosetta/application.js @@ -1,13 +1,17 @@ //= require ./vendor/vue.min //= require ./vendor/lunr +//= require ./vendor/autosize.min function initPhrasesList(selector, phrases) { new Vue({ el: selector, + data: { phrases: phrases, - query: '' + query: '', + menuOpened: false, }, + computed: { searchIndex: function() { var that = this; @@ -17,14 +21,14 @@ function initPhrasesList(selector, phrases) { this.field('text'); that.phrases.forEach(function (phrase) { - this.add(phrase) + this.add(phrase); }, this); }); }, + filteredPhrases: function () { if (this.query) { var results = this.searchIndex.search(this.query); - return this.phrases.filter(function (phrase) { return results.some(function (result) { return result.ref === phrase.code; @@ -34,6 +38,19 @@ function initPhrasesList(selector, phrases) { return this.phrases; } } + }, + + updated: function () { + this.$nextTick(function () { + autosize(document.querySelectorAll('.database__field')); + }); + }, + + methods: { + toggleNav: function() { + this.menuOpened = this.menuOpened ? false : true; + console.log('toggleNav', this.menuOpened); + } } }); } diff --git a/app/assets/javascripts/rosetta/vendor/autosize.min.js b/app/assets/javascripts/rosetta/vendor/autosize.min.js new file mode 100755 index 0000000..4d9b4e9 --- /dev/null +++ b/app/assets/javascripts/rosetta/vendor/autosize.min.js @@ -0,0 +1,6 @@ +/*! + autosize 4.0.2 + license: MIT + http://www.jacklmoore.com/autosize +*/ +!function(e,t){if("function"==typeof define&&define.amd)define(["module","exports"],t);else if("undefined"!=typeof exports)t(module,exports);else{var n={exports:{}};t(n,n.exports),e.autosize=n.exports}}(this,function(e,t){"use strict";var n,o,p="function"==typeof Map?new Map:(n=[],o=[],{has:function(e){return-1 +

Rosetta

+

Rosetta is available as open source under the terms of the MIT License.

+

View in Github

+ \ No newline at end of file diff --git a/app/views/rosetta/_phrases_list.html.erb b/app/views/rosetta/_phrases_list.html.erb new file mode 100644 index 0000000..77448e4 --- /dev/null +++ b/app/views/rosetta/_phrases_list.html.erb @@ -0,0 +1,9 @@ +
+ + +
+ <%= render "rosetta/#{repository_id}/actions_vue" %> +
+
\ No newline at end of file diff --git a/app/views/rosetta/_translate_menu.html.erb b/app/views/rosetta/_translate_menu.html.erb index 11743ab..e56a58d 100644 --- a/app/views/rosetta/_translate_menu.html.erb +++ b/app/views/rosetta/_translate_menu.html.erb @@ -1,86 +1,34 @@ <% if rosetta? %> <%= stylesheet_link_tag 'rosetta/application' %> + <%= javascript_include_tag 'rosetta/application' %> -
-
+
+
<%= image_tag('rosetta/language_icon.svg') %>
+
<%= image_tag('rosetta/close.svg') %>
+

<%= Rosetta.repository.label %> [<%= Rosetta.locale %>]

+ <%= link_to 'All Phrases', rosetta.phrases_path %>
+
-

- Select any text in the page to search the corresponding translation. -

- -
-

<%= link_to 'View all phrases', rosetta.phrases_path, target: :blank %>

+ <%= render 'rosetta/phrases_list', repository_id: Rosetta.repository.id %> - <% Rosetta.phrases.each do |phrase| %> - <%= render "rosetta/#{Rosetta.repository.id}/actions", - phrase: phrase %> - <% end %> -
- + <%= render 'rosetta/footer' %>
- <% end %> diff --git a/app/views/rosetta/database/_actions.html.erb b/app/views/rosetta/database/_actions.html.erb deleted file mode 100644 index b4f8111..0000000 --- a/app/views/rosetta/database/_actions.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -
-
- <%= phrase.code %> -
-
- <%= form_tag(rosetta.database_repository_phrase_path(id: phrase.code), method: :put, id: phrase.code) do %> - <%= hidden_field_tag(:current_path, url_for) %> - <%= text_area_tag(:value, phrase.text, id: "#{phrase.code}_value", class: 'database__field') %> - <%= submit_tag("Update", id: "#{phrase.code}_submit") %> - <% end %> -
-
diff --git a/app/views/rosetta/database/_actions_vue.html b/app/views/rosetta/database/_actions_vue.html deleted file mode 100644 index cc9826b..0000000 --- a/app/views/rosetta/database/_actions_vue.html +++ /dev/null @@ -1,8 +0,0 @@ -
-
- {{ phrase.code }} -
-
- TODO -
-
diff --git a/app/views/rosetta/database/_actions_vue.html.erb b/app/views/rosetta/database/_actions_vue.html.erb new file mode 100644 index 0000000..e3a1d86 --- /dev/null +++ b/app/views/rosetta/database/_actions_vue.html.erb @@ -0,0 +1,20 @@ +
+
+ {{ phrase.code }} +
+ +
+
+ + + <%= hidden_field_tag :authenticity_token, form_authenticity_token -%> + + + +
+
+ +
+ <%= render 'rosetta/database/additional_actions' %> +
+
diff --git a/app/views/rosetta/database/_additional_actions.html.erb b/app/views/rosetta/database/_additional_actions.html.erb new file mode 100644 index 0000000..9d697a4 --- /dev/null +++ b/app/views/rosetta/database/_additional_actions.html.erb @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/views/rosetta/local/_actions.html.erb b/app/views/rosetta/local/_actions.html.erb deleted file mode 100644 index 3f0bcec..0000000 --- a/app/views/rosetta/local/_actions.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -
-
- <%= phrase.code %> -
- -
- <%= phrase.text %> -
- -
- <%= phrase.repository_link %> -
-
diff --git a/app/views/rosetta/onesky/_actions.html.erb b/app/views/rosetta/onesky/_actions.html.erb deleted file mode 100644 index 92e24b2..0000000 --- a/app/views/rosetta/onesky/_actions.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -<%= link_to(phrase.repository_link, target: '_blank', class: 'phrases-menu__block') do %> -
-
- <%= phrase.code %> -
- -
- <%= phrase.text %> -
-
-<% end %> diff --git a/app/views/rosetta/phrases/index.html.erb b/app/views/rosetta/phrases/index.html.erb index e314ea0..dc53296 100644 --- a/app/views/rosetta/phrases/index.html.erb +++ b/app/views/rosetta/phrases/index.html.erb @@ -4,15 +4,9 @@
-
- +<%= render 'rosetta/phrases_list', repository_id: Rosetta.repository.id %> -
- <%= render "rosetta/#{Rosetta.repository.id}/actions_vue" %> -
-
+<%= render 'rosetta/footer' %>