<commit_before># each type of media responsible for it's own admin/create/edit/update/etc 
# each lives at a root url /slug and show is delegated to media controller

module SwellMedia
	class PagesController < SwellMedia::MediaController
		
		before_filter :authenticate_user!, except: [ :show ]
		before_filter :get_page, except: [ :admin, :create, :index ]

		def admin
			authorize! :admin, SwellMedia::Page
			@pages = Page.page( params[:page] )
			render layout: 'admin'
		end


		def create
			authorize!( :admin, Page )
			@page = Page.new( page_params )
			@page.publish_at ||= Time.zone.now
			@page.status = 'draft'
			if @page.save
				set_flash 'Page Created'
				redirect_to edit_page_path( @page.id )
			else
				set_flash 'Page could not be created', :error, @page
				redirect_to :back
			end
		end
<commit_msg>- order pages in admin<commit_after># each type of media responsible for it's own admin/create/edit/update/etc 
# each lives at a root url /slug and show is delegated to media controller

module SwellMedia
	class PagesController < SwellMedia::MediaController
		
		before_filter :authenticate_user!, except: [ :show ]
		before_filter :get_page, except: [ :admin, :create, :index ]

		def admin
			authorize! :admin, SwellMedia::Page
			@pages = Page.order( publish_at: :desc ).page( params[:page] )
			render layout: 'admin'
		end


		def create
			authorize!( :admin, Page )
			@page = Page.new( page_params )
			@page.publish_at ||= Time.zone.now
			@page.status = 'draft'
			if @page.save
				set_flash 'Page Created'
				redirect_to edit_page_path( @page.id )
			else
				set_flash 'Page could not be created', :error, @page
				redirect_to :back
			end
		end

{'fraction_non_alphanumeric': 0.10295857988165681, 'fraction_numerical': 0.0, 'mean_word_length': 3.620218579234973, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4884229', 'n_tokens_mistral': 636, 'n_tokens_neox': 542, 'n_words': 175}