def copy_errors card card.errors.each do |att, msg| errors.add att, msg end end format do view :closed_missing, perms: :none, closed: true do |args| '' end view :missing, perms: :none do |args| '' end view :not_found, perms: :none, error_code: 404 do |args| %{ Could not find #{card.name.present? ? %{"#{card.name}"} : 'the card requested'}. } end view :server_error, perms: :none, error_code: 500 do |args| %{ Wagn Hitch! Server Error. Yuck, sorry about that.\n}+ %{ To tell us more and follow the fix, add a support ticket at http://wagn.org/new/Support_Ticket } end view :denial, perms: :none, error_code: 403 do |args| focal? ? 'Permission Denied' : '' end view :bad_address, perms: :none, error_code: 404 do |args| %{ 404: Bad Address } end view :too_deep, perms: :none, closed: true do |args| %{ Man, you're too deep. (Too many levels of inclusions at a time) } end view :too_slow, perms: :none, closed: true do |args| %{ Timed out! #{ showname } took too long to load. } end end format :html do def view_for_unknown view, args case when focal? && ok?( :create ) ; :new when commentable?( view, args ) ; view else super end end def commentable? view, args self.class.tagged view, :comment and show_view? :comment_box, args.merge( default_visibility: :hide ) and #developer or wagneer has overridden default ok? :comment end def rendering_error exception, view details = if Auth.always_ok? card_link(error_cardname, class: 'render-error-link') + alert('warning', dismissible: true, alert_class: "render-error-message errors-view admin-error-message") do %{

Error message (visible to admin only)

#{ exception.message }

#{exception.backtrace * "
\n"}
} end else error_cardname end content_tag :span, class: 'render-error alert alert-danger' do [ 'error rendering', details, "(#{view} view)" ].join "\n" end end def unsupported_view view "view #{view} not supported for #{error_cardname}" end view :message, perms: :none, tags: :unknown_ok do |args| frame args do params[:message] end end view :missing do |args| return '' unless card.ok? :create # should this be moved into ok_view? opts = { remote: true, class: "slotter missing-#{ args[:denied_view] || args[:home_view]}" } opts[:path_opts] = { type: args[:type] } if args[:type] wrap args do view_link "Add #{ fancy_title args[:title] }", :new, opts end end view :closed_missing, perms: :none do |args| %{ #{ showname } } end view :conflict, error_code: 409 do |args| wrap args.merge( slot_class: 'error-view' ) do #ENGLISH below alert 'warning' do %{Conflict!#{card.last_action_id}
#{ card_link card.last_action.act.actor.cardname } has also been making changes.
Please examine below, resolve above, and re-submit.
#{ wrap do |args| _render_act_expanded act: card.last_action.act, current_rev_nr: 0 end } } end end end view :errors, perms: :none do |args| if card.errors.any? title = %{ Problems #{%{ with #{card.name} } unless card.name.blank?} } frame args.merge(panel_class: "panel panel-warning", title: title, hide: 'menu' ) do card.errors.map do |attrib, msg| msg = "#{attrib.to_s.upcase}: #{msg}" unless attrib == :abort alert 'warning', dismissible: true, alert_class: 'card-error-msg' do msg end end end end end view :not_found do |args| #ug. bad name. sign_in_or_up_links = if !Auth.signed_in? %{
#{ card_link :signin, text: 'Sign in' } or #{ link_to 'Sign up', card_path('new/:signup') } to create it.
} end frame args.merge(title: 'Not Found', optional_menu: :never) do %{

Could not find #{card.name.present? ? "#{card.name}" : 'that'}.

#{sign_in_or_up_links} } end end view :denial do |args| to_task = if task = args[:denied_task] %{to #{task} this.} else 'to do that.' end if !focal? %{} else frame args do #ENGLISH below message = case when task != :read && Card.config.read_only "We are currently in read-only mode. Please try again later." when Auth.signed_in? "You need permission #{to_task}" else or_signup = if Card.new(type_id: Card::SignupID).ok? :create "or #{ link_to 'sign up', card_url('new/:signup') }" end Env.save_interrupted_action(request.env['REQUEST_URI']) "Please #{ link_to 'sign in', card_url(':signin') } #{or_signup} #{to_task}" end %{

Sorry!

\n
#{ message }
} end end end view :server_error do |args| %{

Wagn Hitch :(

Server Error. Yuck, sorry about that.

Add a support ticket to tell us more and follow the fix.

} end end