interpret 0.1.3 → 0.1.4

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.
Files changed (43) hide show
  1. data/app/controllers/interpret/base_controller.rb +20 -1
  2. data/app/controllers/interpret/tools_controller.rb +7 -0
  3. data/app/controllers/interpret/translations_controller.rb +45 -3
  4. data/app/models/interpret/translation.rb +9 -6
  5. data/app/sweepers/interpret/base_sweeper.rb +4 -0
  6. data/app/sweepers/interpret/translation_sweeper.rb +1 -4
  7. data/app/views/interpret/search/index.html.erb +5 -3
  8. data/app/views/interpret/search/perform.html.erb +2 -4
  9. data/app/views/interpret/tools/index.html.erb +9 -0
  10. data/app/views/interpret/translations/_listing.html.erb +49 -13
  11. data/app/views/interpret/translations/index.html.erb +13 -6
  12. data/app/views/interpret/translations/new.html.erb +15 -0
  13. data/app/views/layouts/interpret.html.erb +13 -25
  14. data/app/views/layouts/interpret_base.html.erb +14 -0
  15. data/config/routes.rb +4 -1
  16. data/lib/generators/interpret/setup_generator.rb +1 -0
  17. data/lib/generators/interpret/templates/migration.rb +1 -0
  18. data/lib/interpret/helpers.rb +19 -8
  19. data/lib/interpret/version.rb +1 -1
  20. data/lib/interpret.rb +11 -13
  21. data/public/javascripts/interpret.js +7 -0
  22. data/public/stylesheets/interpret_style.css +105 -112
  23. data/spec/models/translation_spec.rb +26 -3
  24. data/test_app/app/controllers/application_controller.rb +12 -0
  25. data/test_app/app/models/user.rb +5 -0
  26. data/test_app/app/views/layouts/application.html.erb +4 -4
  27. data/test_app/app/views/pages/index.html.haml +2 -1
  28. data/test_app/config/initializers/interpret.rb +8 -2
  29. data/test_app/db/migrate/{20110209185258_interpret_create_translations.rb → 20110219143622_interpret_create_translations.rb} +1 -0
  30. data/test_app/db/migrate/20110219173536_create_users.rb +13 -0
  31. data/test_app/db/schema.rb +8 -1
  32. data/test_app/db/seeds.rb +4 -0
  33. data/test_app/public/javascripts/interpret.js +7 -0
  34. data/test_app/public/stylesheets/interpret_style.css +105 -112
  35. metadata +9 -11
  36. data/app/views/interpret/translations/_form.html.erb +0 -5
  37. data/app/views/interpret/translations/edit.html.erb +0 -5
  38. data/lib/generators/interpret/views_generator.rb +0 -16
  39. data/test_app/public/index.html +0 -29
  40. data/test_app/public/javascripts/controls.js +0 -965
  41. data/test_app/public/javascripts/dragdrop.js +0 -974
  42. data/test_app/public/javascripts/effects.js +0 -1123
  43. data/test_app/public/javascripts/prototype.js +0 -6001
@@ -1,10 +1,29 @@
1
- class Interpret::BaseController < eval(Interpret.controller.classify)
1
+ class Interpret::BaseController < eval(Interpret.parent_controller.classify)
2
2
  before_filter :set_locale
3
+ before_filter :interpret_set_current_user
3
4
  layout 'interpret'
4
5
 
6
+ protected
7
+ def require_admin
8
+ if @interpret_user && !@interpret_admin
9
+ redirect_to interpret_root_url, :alert => "Not authorized"
10
+ return
11
+ end
12
+ end
13
+
5
14
  private
6
15
  def set_locale
7
16
  I18n.locale = params[:locale] if params[:locale]
8
17
  end
18
+
19
+ def interpret_set_current_user
20
+ if Interpret.current_user && defined?(Interpret.current_user.to_sym)
21
+ @interpret_user = eval(Interpret.current_user)
22
+ @interpret_admin = true
23
+ if Interpret.admin && @interpret_user.respond_to?(Interpret.admin)
24
+ @interpret_admin = @interpret_user.send(Interpret.admin)
25
+ end
26
+ end
27
+ end
9
28
  end
10
29
 
@@ -1,4 +1,5 @@
1
1
  class Interpret::ToolsController < Interpret::BaseController
2
+ before_filter :require_admin
2
3
 
3
4
  def dump
4
5
  Interpret::Translation.dump
@@ -18,6 +19,12 @@ class Interpret::ToolsController < Interpret::BaseController
18
19
  send_data text[5..text.length], :filename => "#{I18n.locale}.yml"
19
20
  end
20
21
 
22
+ def run_update
23
+ Interpret::Translation.update
24
+ Interpret.backend.reload! if Interpret.backend
25
+ redirect_to interpret_tools_url, :notice => "Update done"
26
+ end
27
+
21
28
  def import
22
29
  unless params.has_key? :file
23
30
  redirect_to interpret_tools_url, :alert => "You have to select a file to import."
@@ -8,10 +8,23 @@ class Interpret::TranslationsController < Interpret::BaseController
8
8
  t = Interpret::Translation.arel_table
9
9
  if key
10
10
  @translations = Interpret::Translation.locale(I18n.locale).where(t[:key].matches("#{key}.%"))
11
- @translations = @translations.select{|x| x.key =~ /#{key}\.\w+$/}
11
+ if I18n.locale != I18n.default_locale
12
+ @references = Interpret::Translation.locale(I18n.default_locale).where(t[:key].matches("#{key}.%"))
13
+ end
12
14
  else
13
- @translations = Interpret::Translation.locale(I18n.locale).where(t[:key].does_not_match("%.%")).paginate :page => params[:page]
15
+ @translations = Interpret::Translation.locale(I18n.locale).where(t[:key].does_not_match("%.%"))
16
+ if I18n.locale != I18n.default_locale
17
+ @references = Interpret::Translation.locale(I18n.default_locale).where(t[:key].does_not_match("%.%"))
18
+ end
14
19
  end
20
+ if @interpret_user
21
+ @translations = @translations.where(:protected => false) if !@interpret_admin
22
+ @references = @references.where(:protected => false) if @references && !@interpret_admin
23
+ end
24
+
25
+ # not show translations inside nested folders, \w avoids dots
26
+ @translations = @translations.select{|x| x.key =~ /#{key}\.\w+$/} if key
27
+ @references = @references.select{|x| x.key =~ /#{key}\.\w+$/} if key && @references
15
28
  end
16
29
 
17
30
  def edit
@@ -19,12 +32,17 @@ class Interpret::TranslationsController < Interpret::BaseController
19
32
  end
20
33
 
21
34
  def update
35
+ if @interpret_user && !@interpret_admin && params[:interpret_translation].has_key?(:protected)
36
+ head :error
37
+ return
38
+ end
22
39
  @translation = Interpret::Translation.find(params[:id])
23
40
  old_value = @translation.value
24
41
 
25
42
  respond_to do |format|
26
43
  if @translation.update_attributes(params[:interpret_translation])
27
- msg = respond_to?(:current_user) ? "By [#{current_user}]. " : ""
44
+ msg = ""
45
+ msg << "By [#{@interpret_user}]. " if @interpret_user
28
46
  msg << "Locale: [#{@translation.locale}], key: [#{@translation.key}]. The translation has been changed from [#{old_value}] to [#{@translation.value}]"
29
47
  Interpret.logger.info msg
30
48
 
@@ -39,6 +57,30 @@ class Interpret::TranslationsController < Interpret::BaseController
39
57
  end
40
58
  end
41
59
 
60
+ def new
61
+ @reference = Interpret::Translation.find(params[:translation_id])
62
+ if @reference.locale === I18n.locale.to_s
63
+ redirect_to interpret_root_path
64
+ return
65
+ end
66
+ @translation = Interpret::Translation.new :locale => I18n.locale, :key => @reference.key
67
+ end
68
+
69
+ def create
70
+ @reference = Interpret::Translation.find(params[:translation_id])
71
+ if @reference.locale == I18n.locale.to_s
72
+ redirect_to interpret_root_path
73
+ return
74
+ end
75
+ @translation = Interpret::Translation.new params[:interpret_translation].merge(:locale => I18n.locale, :key => @reference.key)
76
+
77
+ if @translation.save
78
+ redirect_to interpret_root_path(:locale => I18n.locale), :notice => "New translation created"
79
+ else
80
+ render :action => :new
81
+ end
82
+ end
83
+
42
84
  private
43
85
  def get_tree
44
86
  @tree = session[:tree] ||= Interpret::Translation.get_tree
@@ -47,9 +47,11 @@ module Interpret
47
47
  end
48
48
 
49
49
  # Import the contents of the given .yml locale file into the database
50
- # backend. All the existing translations for the given language will be
51
- # erased, the backend will contain only the translations from the file
52
- # (in that language).
50
+ # backend. If a given key already exists in database, it will be
51
+ # overwritten, otherwise it won't be touched. This means that in any
52
+ # case it will delete an existing translation, it only overwrites the
53
+ # ones you give in the file.
54
+ # If the given file has new translations, these will be ignored.
53
55
  #
54
56
  # The language will be obtained from the first unique key of the yml
55
57
  # file.
@@ -61,13 +63,14 @@ module Interpret
61
63
  raise ArgumentError, "the YAML file must contain an unique first key representing the locale" unless hash.keys.count == 1
62
64
 
63
65
  lang = hash.keys.first
64
- delete_all(:locale => lang)
65
66
 
66
67
  records = parse_hash(hash.first[1], lang)
67
- # TODO: Replace with activerecord-import bulk inserts
68
68
  transaction do
69
69
  records.each do |x|
70
- x.save!
70
+ if tr = locale(lang).find_by_key(x.key)
71
+ tr.value = x.value
72
+ tr.save!
73
+ end
71
74
  end
72
75
  end
73
76
  end
@@ -5,6 +5,10 @@ class Interpret::BaseSweeper < ActionController::Caching::Sweeper
5
5
  expire_cache(translation)
6
6
  end
7
7
 
8
+ def after_create(translation)
9
+ expire_cache(translation)
10
+ end
11
+
8
12
  protected
9
13
 
10
14
  # Implement user's custom expire logic
@@ -5,10 +5,7 @@ class Interpret::TranslationSweeper < ActionController::Caching::Sweeper
5
5
  Interpret.backend.reload! if Interpret.backend
6
6
  end
7
7
 
8
- private
9
- def expire_cache
10
- #expire_action :controller => "interpret/translations", :action => :tree
11
- session.delete(:tree)
8
+ def after_create(translation)
12
9
  Interpret.backend.reload! if Interpret.backend
13
10
  end
14
11
  end
@@ -1,3 +1,5 @@
1
+ <% interpret_title "Interpret - Search" %>
2
+
1
3
  <div id="header">
2
4
  <h1>Search translations</h1>
3
5
  </div>
@@ -20,10 +22,10 @@
20
22
 
21
23
  <% end %>
22
24
 
23
- <%= content_for :sidebar do %>
25
+ <% content_for :sidebar do %>
24
26
  <h2>Search</h2>
25
27
  <p>
26
- You can use this search feature to look into all the translations. Can be filtered by language, key and phrase.
28
+ You can use this search feature to look into all the translations. Can be filtered by language, key and phrase.
27
29
  </p>
28
30
  <% end %>
29
- </div>
31
+ </div>
@@ -1,4 +1,4 @@
1
- <%= content_for :title do %>
1
+ <% content_for :title do %>
2
2
  Search translations
3
3
  <%= "by " unless params[:key].blank? && params[:value].blank? %>
4
4
  <%= params[:key] unless params[:key].blank? %>
@@ -10,11 +10,9 @@
10
10
  <h1>Search translations</h1>
11
11
  </div>
12
12
 
13
-
14
13
  <%= render 'interpret/translations/listing' %>
15
14
 
16
-
17
- <%= content_for :sidebar do %>
15
+ <% content_for :sidebar do %>
18
16
  <h2>Search</h2>
19
17
  <p>
20
18
  <%= @translations.size %> results found.
@@ -1,3 +1,5 @@
1
+ <% interpret_title "Interpret - Tools" %>
2
+
1
3
  <div class="header">
2
4
  <h1>Your master language</h1>
3
5
  </div>
@@ -8,6 +10,13 @@ can change it below:
8
10
  </p>
9
11
  <p><em>TODO</em></p>
10
12
 
13
+ <div class="header">
14
+ <h1>Update contents from yml locale files</h1>
15
+ </div>
16
+
17
+ <p>update all your application translatinos from the yml files.<br/>
18
+ </p>
19
+ <%= button_to "Update contents", run_update_interpret_tools_path %>
11
20
  <div class="header">
12
21
  <h1>Dump .yml contents into database</h1>
13
22
  </div>
@@ -1,22 +1,58 @@
1
1
  <table>
2
2
  <thead>
3
3
  <tr class="header">
4
- <th>Key</th>
5
- <th>Content</th>
4
+ <% if @references %>
5
+ <th>Master translation [<%= I18n.default_locale %>]</th>
6
+ <% else %>
7
+ <th>Key</th>
8
+ <% end %>
9
+ <th>Content [<%= I18n.locale %>]</th>
10
+ <% if @interpret_admin && @references.nil? %>
11
+ <th style="width:5%">Protected?</th>
12
+ <% end %>
6
13
  </tr>
7
14
  </thead>
8
15
  <tbody>
9
- <% @translations.each do |x| %>
10
- <tr id="translation_<%= x.id %>">
11
- <td><%= x.key %></td>
12
- <td>
13
- <%= best_in_place x, :value,
14
- :type => :textarea,
15
- :path => interpret_translation_path(x),
16
- :activator => "#translation_#{x.id}",
17
- :sanitize => false %>
18
- </td>
19
- </tr>
16
+ <% unless @references %>
17
+ <% @translations.each do |x| %>
18
+ <tr<%= " class='protected'" if x.protected %>>
19
+ <td class='key'><%= x.key %></td>
20
+ <td class="content" id="translation_<%= x.id %>">
21
+ <%= best_in_place x, :value,
22
+ :type => :textarea,
23
+ :path => interpret_translation_path(x),
24
+ :activator => "#translation_#{x.id}",
25
+ :sanitize => false %>
26
+ </td>
27
+ <% if @interpret_admin%>
28
+ <td style="width:5%" class='protection_input' id="protection_<%= x.id %>">
29
+ <%= best_in_place x, :protected,
30
+ :type => :checkbox,
31
+ :path => interpret_translation_path(x),
32
+ :activator => "#protection_#{x.id}"
33
+ %>
34
+ </td>
35
+ <% end %>
36
+ </tr>
37
+ <% end %>
38
+ <% else %>
39
+ <% @references.each do |x| %>
40
+ <% trans = @translations.detect{|y| y.key == x.key} %>
41
+ <tr<%= " id='translation_#{trans.id}'" if trans %><%= " class='protected'" if x.protected %>>
42
+ <td style='width:50%'><%= x.value %></td>
43
+ <td style='width:50%'>
44
+ <% if trans %>
45
+ <%= best_in_place trans, :value,
46
+ :type => :textarea,
47
+ :path => interpret_translation_path(trans),
48
+ :activator => "#translation_#{trans.id}",
49
+ :sanitize => false %>
50
+ <% else %>
51
+ <%= link_to "[Create missing translation]", new_interpret_translation_translation_path(x) %>
52
+ <% end %>
53
+ </td>
54
+ </tr>
55
+ <% end %>
20
56
  <% end %>
21
57
  </tbody>
22
58
  </table>
@@ -1,8 +1,7 @@
1
- <%= content_for :title do %>
2
- Translation list
3
- <% end %>
1
+ <% interpret_title "Interpret - Translations" %>
2
+
4
3
  <div id="header">
5
- <h1>Translations for <%= I18n.locale %></h1>
4
+ <h1>Translations for [<%= I18n.locale %>]</h1>
6
5
  </div>
7
6
  <p>
8
7
  Below are the translations without any particulary key in your application.
@@ -12,9 +11,17 @@ rest of your app's contents, navigate using the tree in the left, that shows you
12
11
  locales structure.
13
12
  </p>
14
13
 
14
+ <p>
15
+ <% if @references %>
16
+ There are <%= @references.size - @translations.size %> / <%= @references.size %> missing translations.
17
+ <% else %>
18
+ There are <%= @translations.size %> translations.
19
+ <% end %>
20
+ </p>
21
+
15
22
  <%= render 'interpret/translations/listing' %>
16
23
 
17
- <%= content_for :sidebar do %>
24
+ <% content_for :sidebar do %>
18
25
  <div id="tree_sidebar">
19
26
  <h3>
20
27
  <% if params[:key] %>
@@ -23,6 +30,6 @@ locales structure.
23
30
  /
24
31
  <% end %>
25
32
  </h3>
26
- <%= show_interpret_tree(@tree, params[:key]) %>
33
+ <%= interpret_show_tree(@tree, params[:key]) %>
27
34
  </div>
28
35
  <% end %>
@@ -0,0 +1,15 @@
1
+ <% interpret_title "Interpret - New translation" %>
2
+
3
+ <h1>Creating '<%= @translation.key %>'</h1>
4
+
5
+ <p>
6
+ Previous value:
7
+ <b>[<%= @reference.locale %>] <%= @reference.value %></b>
8
+ </p>
9
+ <%= form_for [@reference, @translation], :url => interpret_translation_translations_path(@reference) do |f| %>
10
+ <%= f.label :value, "Translation to [#{I18n.locale}]" %>
11
+ <%= f.text_area :value, :value => @translation.value %>
12
+ <%= f.submit %>
13
+ <% end %>
14
+
15
+ <%= link_to "Back", interpret_root_path %>
@@ -1,28 +1,23 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>INTERPRET - <%= yield :title %></title>
5
- <%= stylesheet_link_tag "interpret_style" %>
6
- <%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" %>
7
- <%= javascript_include_tag "jquery.purr" %>
8
- <%= javascript_include_tag "best_in_place" %>
9
- <%= csrf_meta_tag %>
10
- </head>
11
- <body>
12
- <div id="container">
13
- <div class="menu grid_16">
1
+
2
+ <div id="interpret_container">
3
+ <div class="menu grid_12">
14
4
  <%= interpret_section_link_to "Overview", interpret_root_path %> |
15
- <%= interpret_section_link_to "Tools", interpret_tools_path %> |
5
+ <% if @interpret_admin %>
6
+ <%= interpret_section_link_to "Tools", interpret_tools_path %> |
7
+ <% end %>
16
8
  <%= interpret_section_link_to "Search", interpret_search_path %>
17
9
  <hr />
18
10
  </div>
19
- <div class="menu grid_16">
11
+ <div class="menu grid_4">
20
12
  Languages:
21
- <% I18n.available_locales.each do |locale| %>
22
- <%= link_to locale, :locale => locale %>
13
+ <% Interpret::Translation.available_locales.each do |locale| %>
14
+ <% opts = {:locale => locale} %>
15
+ <% opts[:key] = params[:key] if params[:key] %>
16
+ <%= link_to locale, opts %>
23
17
  <% end %>
24
18
  <hr />
25
19
  </div>
20
+ <div class="clearfix"></div>
26
21
  <div id="sidebar" class="grid_3">
27
22
  <%= yield :sidebar %>
28
23
  </div>
@@ -31,11 +26,4 @@
31
26
  </div>
32
27
  </div>
33
28
 
34
- <%= javascript_tag do %>
35
- $(document).ready(function() {
36
- /* Activating Best In Place */
37
- jQuery(".best_in_place").best_in_place()
38
- });
39
- <% end %>
40
- </body>
41
- </html>
29
+ <% interpret_parent_layout Interpret.layout %>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= yield :title %></title>
5
+ <%= stylesheet_link_tag "interpret_style" %>
6
+ <%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" %>
7
+ <%= javascript_include_tag "jquery.purr", "best_in_place", "interpret" %>
8
+ <%= csrf_meta_tag %>
9
+ </head>
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
14
+
data/config/routes.rb CHANGED
@@ -1,13 +1,16 @@
1
1
  Rails.application.routes.draw do
2
2
  scope Interpret.scope do
3
3
  namespace :interpret do
4
- resources :translations, :only => [:edit, :update]
4
+ resources :translations, :only => [:edit, :update] do
5
+ resources :translations, :only => [:new, :create]
6
+ end
5
7
 
6
8
  resources :tools, :only => :index do
7
9
  collection do
8
10
  get :export
9
11
  post :import
10
12
  post :dump
13
+ post :run_update
11
14
  end
12
15
  end
13
16
 
@@ -9,6 +9,7 @@ module Interpret
9
9
  end
10
10
 
11
11
  def copy_js
12
+ copy_file "javascripts/interpret.js", "public/javascripts/interpret.js"
12
13
  copy_file "javascripts/jquery.purr.js", "public/javascripts/jquery.purr.js"
13
14
  end
14
15
 
@@ -6,6 +6,7 @@ class InterpretCreateTranslations < ActiveRecord::Migration
6
6
  t.text :value
7
7
  t.text :interpolations
8
8
  t.boolean :is_proc, :default => false
9
+ t.boolean :protected, :default => false
9
10
  end
10
11
  end
11
12
 
@@ -2,7 +2,7 @@ module Interpret
2
2
  module InterpretHelpers
3
3
 
4
4
  # Generates the html tree from the given keys
5
- def show_interpret_tree(tree, origin_keys)
5
+ def interpret_show_tree(tree, origin_keys)
6
6
  tree = tree.first[1]
7
7
  unless origin_keys.nil?
8
8
  origin_keys.split(".").each do |key|
@@ -12,8 +12,25 @@ module Interpret
12
12
  build_tree(tree, origin_keys)
13
13
  end
14
14
 
15
+ def interpret_section_link_to(name, options = {}, html_options = {})
16
+ html_options.merge!({ :class => 'current' }) if current_controller?(options)
17
+ link_to name, options, html_options
18
+ end
19
+
20
+ def interpret_title(title)
21
+ content_for :title do
22
+ title
23
+ end
24
+ end
25
+
26
+ def interpret_parent_layout(layout)
27
+ @_content_for[:layout] = self.output_buffer
28
+ self.output_buffer = render(:file => "layouts/#{layout}")
29
+ end
30
+
31
+ private
15
32
  def build_tree(hash, origin_keys = "", prev_key = "")
16
- out = "<ul id='navigation'>"
33
+ out = "<ul>"
17
34
  if origin_keys.present? && prev_key.blank?
18
35
  parent_key = origin_keys.split(".")[0..-2].join(".")
19
36
  if parent_key.blank?
@@ -35,11 +52,5 @@ module Interpret
35
52
  hash = Rails.application.routes.recognize_path(url_for(opts))
36
53
  params[:controller] == hash[:controller]
37
54
  end
38
-
39
- def interpret_section_link_to(name, options = {}, html_options = {})
40
- html_options.merge!({ :class => 'current' }) if current_controller?(options)
41
- link_to name, options, html_options
42
- end
43
-
44
55
  end
45
56
  end
@@ -1,3 +1,3 @@
1
1
  module Interpret
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/interpret.rb CHANGED
@@ -5,24 +5,22 @@ require 'lazyhash'
5
5
  module Interpret
6
6
  mattr_accessor :backend
7
7
  mattr_accessor :logger
8
-
9
- mattr_accessor :controller
10
- @@controller = "action_controller/base"
11
-
12
8
  mattr_accessor :sweeper
13
- @@sweeper = nil
14
-
9
+ mattr_accessor :parent_controller
15
10
  mattr_accessor :registered_envs
16
- @@registered_envs = [:production, :staging]
17
-
18
11
  mattr_accessor :scope
12
+ mattr_accessor :current_user
13
+ mattr_accessor :admin
14
+ mattr_accessor :layout
15
+
16
+ @@controller = "action_controller/base"
17
+ @@registered_envs = [:production, :staging]
19
18
  @@scope = ""
19
+ @@layout = "interpret_base"
20
20
 
21
- # More options:
22
- # - memoize?
23
- # - flatten?
24
- # - logging?
25
- # - current_user method. If set, current_user will appear in logs, otherwise not.
21
+ def self.configure
22
+ yield self
23
+ end
26
24
  end
27
25
 
28
26
  require 'interpret/engine' if defined? Rails
@@ -0,0 +1,7 @@
1
+ $(document).ready(function() {
2
+ $("#interpret_container .protection_input").click(function() {
3
+ $(this).parent().toggleClass("protected");
4
+ });
5
+ /* Activating Best In Place */
6
+ $("#interpret_container .best_in_place").best_in_place()
7
+ });