format :html do view :server_error, template: :haml view :debug_server_error, wrap: { modal: { size: :full } } do error_page = BetterErrors::ErrorPage.new Card::Error.current, "PATH_INFO" => request.env["REQUEST_URI"] haml :debug_server_error, {}, error_page end view :message, perms: :none, unknown: true do frame { params[:message] } end view :missing do createable do wrap { missing_link("#{fa_icon 'plus-square'} #{_render_title}") } end end def createable card.ok?(:create) ? yield : "" end def missing_link text path_opts = voo.type ? { card: { type: voo.type } } : {} link_to_view :new_in_modal, text, path: path_opts, class: classy("missing-link") end view :closed_missing, perms: :none do wrap_with :span, h(title_in_context), class: "faint" end view :conflict, cache: :never do actor_link = link_to_card card.last_action.act.actor.name class_up "card-slot", "error-view" wrap do # ENGLISH below alert "warning" do %( Conflict! #{card.last_action_id}
#{CGI.escapeHTML exception.message}
#{h attribute.to_s.upcase}: #{h message}
" end def not_found_errors if card.errors.any? standard_errors else haml :not_found end end def sign_in_or_up_links to_task return if Auth.signed_in? links = [signin_link, signup_link].compact.join " #{tr :or} " wrap_with(:div) do [tr(:please), links, to_task].join(" ") + "." end end def signin_link link_to_card :signin, tr(:sign_in), class: "signin-link", slotter: true, path: { view: :open } end def signup_link return unless signup_ok? link_to_card :signup, tr(:sign_up), class: "signup-link", slotter: true, path: { action: :new } end def signup_ok? Card.new(type_id: Card::SignupID).ok? :create end def quiet_denial wrap_with :span, class: "denied" do "" end end def loud_denial voo.hide :menu frame do [wrap_with(:h1, tr(:sorry)), wrap_with(:div, loud_denial_message)] end end def loud_denial_message to_task = @denied_task ? tr(:denied_task, denied_task: @denied_task) : tr(:to_do_that) case when not_denied_task_read? tr(:read_only) when Auth.signed_in? tr(:need_permission_task, task: to_task) else Env.save_interrupted_action request.env["REQUEST_URI"] sign_in_or_up_links to_do_unauthorized_task end end def not_denied_task_read? @denied_task != :read && Card.config.read_only end def to_do_unauthorized_task @denied_task ? tr(:denied_task, denied_task: @denied_task) : tr(:to_do_that) end end