Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
add support for ok help texts which can be edited from the admin
Browse files Browse the repository at this point in the history
  • Loading branch information
OriHoch committed May 28, 2016
1 parent 96235b0 commit 45a5c96
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 24 deletions.
45 changes: 24 additions & 21 deletions static/js/okhelptexts.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
function placeHelptext(obj,left,top) {
$('#helptextcontainer').empty();
obj.clone().appendTo($('#helptextcontainer'))

if (left<500) {
$('#helptextcontainer .helptext').removeClass('right')
$('#helptextcontainer .helptext').addClass('left')
} else {
$('#helptextcontainer .helptext').removeClass('left')
$('#helptextcontainer .helptext').addClass('right')
}

$('#helptextcontainer .helptext').css('z-index',1000);
$('#helptextcontainer .helptext .x').bind('click',function(){
$('#helptextcontainer').empty();});
$('#helptextcontainer .helptext').css('display','inline-block');
$('#helptextcontainer .helptext').css('top',top-50).css('left',left);
function showHelpText(elt) {
var helptext = $(elt).data('helptext');
var moreinfo = $(elt).data('moreinfo');
if (moreinfo) {
helptext += '<p><a href="'+moreinfo+'">למידע נוסף</a></p>'
}
$('#okhelptextscontainer .modal-body p').html(helptext);
$('#okhelptextscontainer').modal();
}
$('body').append('<div id="helptextcontainer"></div>');
$(document).ready(function() {
$('.quest-mark').click(function(e) {placeHelptext($(e.currentTarget).find(".helptext"),e.pageX,e.pageY)});
});
$(function() {
$('body').append('' +
'<div id="okhelptextscontainer" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">' +
// '<div class="modal-header">' +
// '<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>' +
// '<h3>Modal header</h3>' +
// '</div>' +
'<div class="modal-body">' +
'<p></p>' +
'</div>' +
'<div class="modal-footer">' +
'<button class="btn" data-dismiss="modal" aria-hidden="true">סגור</button>' +
'</div>' +
'</div>' +
'');
});
12 changes: 10 additions & 2 deletions templates/laws/bill_detail.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "site_base.html" %}
{% load i18n laws_tags bills_tags mks_tags links_tags voting_tags agendas_tags i18ninclude %}
{% load i18n laws_tags bills_tags mks_tags links_tags voting_tags agendas_tags i18ninclude hlp %}
{% load static from staticfiles %}
{% block extracss %}
<link href="{% static "css/jquery.autocomplete.css" %}" rel="stylesheet" type="text/css" media="screen"/>
Expand Down Expand Up @@ -176,7 +176,7 @@ <h4>{% trans "proposers" %}</h4>
{% include "mks/member_photos.html" with members=proposers %}
{% endif %}
</section>
<section class="card card-list padded">
<section class="card card-list padded">{% ht "Legistlation Process" %}
<p>
{% trans 'stage' %}:<strong{% if object.frozen %}
class="text-error"{% endif %}>{% trans object.get_stage_display %}</strong>
Expand All @@ -186,6 +186,7 @@ <h4>{% trans "proposers" %}</h4>
<section
class="bill-stage {% if object.proposals.all or object.gov_proposal %}past-stage{% else %}future-stage{% endif %}">
<h2>{% trans 'Bill initiation' %}</h2>
{% ht "Legistlation stage: initiation" %}
<ul class="dates-list">
{% if object.gov_proposal %}
<li>
Expand Down Expand Up @@ -235,6 +236,7 @@ <h3 id="pp{{ pp.pk }}ModalLabel">{{ pp.title }}</h3>
<section id="pre-vote"
class="bill-stage {% if object|bill_is_past_stage:"PRE_APPROVED" or object.pre_votes.all %}past-stage{% else %}future-stage{% endif %}">
<h2>{% trans 'Pre Vote' %}</h2>
{% ht "Legistlation stage: Pre Vote" %}
<ul class="dates-list">
{% for v in object.pre_votes.all %}
<li {% if forloop.counter > 3 %}class="list-more" {% endif %}>
Expand Down Expand Up @@ -282,6 +284,7 @@ <h2>{% trans 'Pre Vote' %}</h2>
<section
class="bill-stage {% if object|bill_is_past_stage:"IN_COMMITTEE" or object.first_committee_meetings.all %}past-stage{% else %}future-stage{% endif %}">
<h2>{% trans 'Committee Meetings' %}</h2>
{% ht "Legistlation stage: Committee Meetings" %}
<ul class="dates-list">
{% for cm in object.first_committee_meetings.all %}
<li {% if forloop.counter > 5 %}class="list-more" {% endif %}>
Expand All @@ -297,6 +300,7 @@ <h2>{% trans 'Committee Meetings' %}</h2>
<section
class="bill-stage {% if object.knesset_proposal %}past-stage{% else %}future-stage{% endif %}">
<h2>{% trans 'Bill formulated by the committee' %}</h2>
{% ht "Legistlation stage: Bill formulated by the committee" %}
{% if object.knesset_proposal %}
<ul class="dates-list">
<li>
Expand Down Expand Up @@ -327,6 +331,7 @@ <h2>{% trans 'Bill formulated by the committee' %}</h2>
<section id="first-vote"
class="bill-stage {% if object.first_vote %}past-stage{% else %}future-stage{% endif %}">
<h2>{% trans 'First Vote' %}</h2>
{% ht "Legistlation stage: First Vote" %}
<ul class="dates-list">
{% if object.first_vote %}
<li><a class="item" href="{% url 'vote-detail' object.first_vote.id %}">
Expand Down Expand Up @@ -367,6 +372,7 @@ <h2>{% trans 'First Vote' %}</h2>
<section
class="bill-stage {% if object.second_committee_meetings.all %}past-stage{% else %}future-stage{% endif %}">
<h2>{% trans 'Committee Meetings' %}</h2>
{% ht "Legistlation stage: Committee Meetings" %}
<ul class="dates-list">
{% for cm in object.second_committee_meetings.all %}
<li {% if forloop.counter > 5 %}class="list-more" {% endif %}>
Expand All @@ -380,6 +386,7 @@ <h2>{% trans 'Committee Meetings' %}</h2>
<section id="third-vote"
class="bill-stage {% if object.approval_vote %}past-stage{% else %}future-stage{% endif %}">
<h2>{% trans 'Bill Approval' %}</h2>
{% ht "Legistlation stage: Bill Approval" %}
<ul class="dates-list">
{% if object.approval_vote %}
<li><a class="item" href="{% url 'vote-detail' object.approval_vote.id %}">
Expand Down Expand Up @@ -420,6 +427,7 @@ <h2>{% trans 'Bill Approval' %}</h2>
<section
class="gov-decision {% if object.gov_decisions.all %}past-stage{% else %}future-stage{% endif %}">
<h2>{% trans 'Government Stand' %}</h2>
{% ht "Legistlation stage: Government Stand" %}
<ul class="dates-list">
{% for d in object.gov_decisions.all %}
<li>
Expand Down
5 changes: 4 additions & 1 deletion templates/okhelptexts/okhelptext.html
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{%load i18n%}{% if helptext %}<span class='quest-mark'><img src='/static/icons/help_16.png'><span class='triangle-border right helptext' style='display:none'><span class='x'>X</span>{{helptext}}{% if moreinfo %}<a href='{{moreinfo}}' target='_blank'>{%trans 'For More Info Click Here'%}</a>{%endif%}</span></span>{%endif%}
{%load i18n%}
{% if helptext %}
<a class="btn btn-mini btn-question" href="javascript:;" onClick="showHelpText(this);" data-helptext="{{ helptext }}" data-moreinfo="{{ moreinfo }}">?</a>
{%endif%}

0 comments on commit 45a5c96

Please sign in to comment.