Skip to content

Commit

Permalink
Workshop contributions enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
agordillo committed Jun 7, 2016
1 parent 5192ad4 commit 141d214
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,9 @@ ul.workshop_activities_list_edit

// Contributions
.new_contribution_resource
#url_choose_wa
div.url_choose_wa
margin-top: 25px
#url_choose_wa_input
input.url_choose_wa_input
width: 100%
padding: 5px
div.modal-dialog
Expand Down
35 changes: 20 additions & 15 deletions app/views/contributions/new.partial.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
<div class="modal-body">
<div class="joining_tabs clearfix">
<ul class="nav nav-tabs">
<li class="active"><a href="#url_choose_wa" data-toggle="tab"><%=t("workshop.activities.assignment.modal.url_tab")%></a></li>
<li><a href="#excursions_choose_wa" data-toggle="tab"><%=t("search.models.excursion")%></a></li>
<li><a href="#resources_choose_wa" data-toggle="tab"><%=t("search.models.resource")%></a></li>
<li class="active"><a class="url_choose_wa" data-toggle="tab"><%=t("workshop.activities.assignment.modal.url_tab")%></a></li>
<li><a class="excursions_choose_wa" data-toggle="tab"><%=t("search.models.excursion")%></a></li>
<li><a class="resources_choose_wa" data-toggle="tab"><%=t("search.models.resource")%></a></li>
</ul>
<div id="url_choose_wa" class="tab-pane">
<div class="url_choose_wa" class="tab-pane">
<div><p><%=t("workshop.activities.assignment.modal.url_explanation")%></p></div>
<input id="url_choose_wa_input" type="text" placeholder="<%=Vish::Application.config.full_domain%>/..."/>
<input class="url_choose_wa_input" type="text" placeholder="<%=Vish::Application.config.full_domain%>/..."/>
</div>
<div id="excursions_choose_wa" class="tab-pane">
<div class="excursions_choose_wa" class="tab-pane">
<% unless excursions.blank? %>
<ul class="items">
<% with_format('html') do %>
Expand All @@ -34,11 +34,11 @@
</ul>
<% else %>
<% if !current_subject.nil? %>
<div id="no_items"><%= I18n.t('workshop.activities.assignment.modal.notfound') %></div>
<div class="no_items"><%= I18n.t('workshop.activities.assignment.modal.notfound') %></div>
<% end %>
<% end %>
</div>
<div id="resources_choose_wa" class="tab-pane">
<div class="resources_choose_wa" class="tab-pane">
<% unless resources.blank? %>
<ul class="items">
<% with_format('html') do %>
Expand All @@ -49,7 +49,7 @@
</ul>
<% else %>
<% if !current_subject.nil? %>
<div id="no_items"><%= notfound %></div>
<div class="no_items"><%= notfound %></div>
<% end %>
<% end %>
</div>
Expand All @@ -68,6 +68,13 @@
var form = $("#" + formId);
var formButton = $(form).find(".button_for_contribution");

$(form).find("a.url_choose_wa").attr("href","#"+formId+"_url_choose_wa");
$(form).find("div.url_choose_wa").attr("id",formId+"_url_choose_wa");
$(form).find("a.excursions_choose_wa").attr("href","#"+formId+"_excursions_choose_wa");
$(form).find("div.excursions_choose_wa").attr("id",formId+"_excursions_choose_wa");
$(form).find("a.resources_choose_wa").attr("href","#"+formId+"_resources_choose_wa");
$(form).find("div.resources_choose_wa").attr("id",formId+"_resources_choose_wa");

$(form).find(".joining_tabs").tabs();
$(formButton).attr("disabled", "disabled");

Expand All @@ -94,8 +101,8 @@
}
});

$(form).find("#url_choose_wa_input").on("keyup",function(){
var inputTabActive = $(form).find(".joining_tabs a[href='#url_choose_wa']").parent("li").hasClass("active");
$(form).find(".url_choose_wa_input").on("keyup",function(){
var inputTabActive = $(form).find(".joining_tabs a.url_choose_wa").parent("li").hasClass("active");
if(($(formButton).attr("submitting")==="true")||(inputTabActive===false)){
return;
}
Expand All @@ -119,9 +126,9 @@
return;
}

var inputTabActive = $(form).find(".joining_tabs a[href='#url_choose_wa']").parent("li").hasClass("active");
var inputTabActive = $(form).find(".joining_tabs a.url_choose_wa").parent("li").hasClass("active");
if(inputTabActive){
var selectedUrl = $(form).find("#url_choose_wa_input").val();
var selectedUrl = $(form).find(".url_choose_wa_input").val();
} else {
var selectedUrl = $(form).find('.selected a').attr("url");
}
Expand All @@ -140,8 +147,6 @@

var contribution_parent_key = $(form).attr("contribution-parent-key");
var contribution_parent_value = $(form).attr("contribution-parent-value");
console.log(contribution_parent_key);
console.log(contribution_parent_value);
var contribution = {
type: "Resource"
}
Expand Down
4 changes: 2 additions & 2 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1241,12 +1241,12 @@ es:
text: "Podrás añadir a este workshop todos los recursos que haya disponibles en Vish. Para añadirlos, abre el recurso en Vish, copia su URL de la barra del navegador y pégala en el siguiente cuadro de texto."
resource_gallery:
add: "Añadir"
title: "Galería recursos"
title: "Galería de recursos"
description: "Añade una galería de recursos"
text: "Las galerías de recursos son un componente del workshop que te permiten incluir varios recursos de Vish de cualquier tipo y tenerlos agrupados para facilitarte su visionado. Inserta este componente en tu workshop y añade recursos de la forma más fácil e intuitiva."
new_resource: "Añadir"
contributions_gallery:
title: "Galería contribuciones"
title: "Galería de contribuciones"
description: "La galería de contribuciones muestra las contribuciones enviadas al workshop"
text: "Los usuarios pueden contribuir a las tareas definidas en un workshop añadiendo recursos o bloques de texto. Con el componente Galería de contribuciones podrás ver de forma agrupada los recursos y/o los textos con los que otros usuarios han contribuido."
error: "A contributions gallery should include at least 1 assignment"
Expand Down

0 comments on commit 141d214

Please sign in to comment.