app/views/petitions/show.html.slim
- title @petition.name
- content_for :head do
meta property="og:url" content=petition_url(@petition)
meta property="og:title" content=@petition.name
- if @petition.image
meta property="og:image" content=asset_url(@petition.image.upload.url(:listing))
meta property="og:description" content=strip_markdown(@petition.description)
meta property="twitter:card" content="summary"
meta property="twitter:site" content="@petities"
javascript:
$(window).on('scroll', function(){
if ($(window).width() > 950) {
floatingElement=$('.petition-form-float-wrapper');
floatTop=$('.petition-form-wrapper').offset().top - $(window).scrollTop();
floatBottom=($('.petition-form-wrapper').offset().top + $('.petition-form-wrapper').innerHeight() - floatingElement.height() - 30) - $(window).scrollTop();
if (floatTop < 0) {
floatingElement.addClass('floating');
} else {
floatingElement.removeClass('floating');
}
if (floatBottom < 0) {
floatingElement.removeClass('floating').addClass('bottom-fixed');
} else {
floatingElement.removeClass('bottom-fixed');
}
}
});
div.page
- if policy(@petition).edit?
div.center
div.petition-edit-button
= link_to(t('edit.petition.edit_petition'), edit_petition_path(@petition))
div.whitespace
- if @updates.any? && @updates.first.created_at > 10.days.ago
div.whitespace
= link_to t('petition.news'), '#petitionnews', class: 'button'
- cache [@petition, @petition.get_count, Globalize.locale.to_s, 'intro'] do
section class=(@petition.image ? 'petition-intro-container' : 'petition-intro-container-noimage')
div.petition-intro-image-container
= image_tag(@petition.image.upload.url(:listing), class: 'petition-intro-image') if @petition.image
div.petition-intro-info-container
h1.petition-intro-info-title= @petition.name
- unless @petition.get_count.zero?
div.petition-intro-info-counter= t('show.signatures_count', display: number_with_delimiter(@petition.get_count), count: @petition.get_count)
div.petition-intro-info-text
p= markdown @petition.description
section.petition-container
div.petition-text-wrapper
- cache [@petition, @petition.get_count, Globalize.locale.to_s, 'text'] do
h2.petition-section-title= t('show.petition.title')
div.petition-text
h3= t('show.petition.we')
= markdown @petition.initiators
p
h3= t('show.petition.observe')
= markdown @petition.statement
p
h3= t('show.petition.request')
= markdown @petition.request
div.petition-form-wrapper
- if @answer
- cache [@petition, @petition.get_count, Globalize.locale.to_s, @answer] do
h2.petition-section-title= t('show.petition.answer')
div.petition-text.petition-answer
h3= markdown @answer.title
= markdown @answer.text
p
- if @petition.status == 'live'
= render partial: 'signform'
- else
div.petition-text
h3= t('show.petition.status.label')
- if @petition.concept?
= t('show.petition.status.will_be_signable')
- else
= t('show.petition.status.was_signable')
p
section.petition-details-container
= render partial: 'detailbox'
= render partial: 'history_chart'
- unless @petition.concept?
= render partial: 'social'
= render partial: 'signatures'
- if @updates.any?
= render partial: 'petition_updates'