8000 added footnote endpoint by naveed-ahmad · Pull Request #112 · quran/quran.com-api · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

added footnote endpoint #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/controllers/v3/foot_notes_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class V3::FootNotesController < ApplicationController
# GET /foot_notes/1
def show
foot_note = FootNote.find(params[:id])

render json: foot_note
end
end
2 changes: 1 addition & 1 deletion app/serializers/v3/translation_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
#

class V3::TranslationSerializer < V3::ApplicationSerializer
attributes :language_name, :text
attributes :language_name, :text, :resource_name
end
6 changes: 3 additions & 3 deletions app/serializers/v3/word_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ class V3::WordSerializer < V3::ApplicationSerializer
:line_number,
:page_number,
:code,
:code_v3
:code_v3,
:char_type

has_one :audio, serializer: V3::AudioFileSerializer

has_one :translation do
object.translations.filter_by_language_or_default scope[:translations]
object.translations.filter_by_language_or_default scope[:language]
end

has_one :transliteration do
object.transliterations.filter_by_language_or_default scope[:translations]
object.transliterations.filter_by_language_or_default scope[:language]
end

def char_type
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Rails.application.routes.draw do
scope :api do
namespace :v3 do
resources :foot_notes, only: :show, defaults: {format: 'json'}

resources :chapters, only: [:index, :show], defaults: {format: 'json'} do
member do
get :info, to: 'chapter_infos#show'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddResourceNameToTranslations < ActiveRecord::Migration[5.0]
def change
add_column :translations, :resource_name, :string
end
end
20 changes: 18 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20170219222537) do
ActiveRecord::Schema.define(version: 20170225055000) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -149,6 +149,18 @@
t.integer "width", null: false
end

create_table "images", force: :cascade do |t|
t.integer "verse_id"
t.integer "resource_content_id"
t.integer "width"
t.string "url"
t.text "alt"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["resource_content_id"], name: "index_images_on_resource_content_id", using: :btree
t.index ["verse_id"], name: "index_images_on_verse_id", using: :btree
end

create_table "language", primary_key: "language_code", id: :text, force: :cascade do |t|
t.text "unicode"
t.text "english", null: false
Expand Down Expand Up @@ -398,6 +410,7 @@
t.string "language_name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "resource_name"
t.index ["language_id"], name: "index_translations_on_language_id", using: :btree
t.index ["resource_content_id"], name: "index_translations_on_resource_content_id", using: :btree
t.index ["resource_type", "resource_id"], name: "index_translations_on_resource_type_and_resource_id", using: :btree
Expand Down Expand Up @@ -532,7 +545,10 @@
t.integer "char_type_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "pause_mark"
t.string "pause_name"
t.string "audio_url"
t.text "image_blob"
t.string "image_url"
t.index ["chapter_id"], name: "index_words_on_chapter_id", using: :btree
t.index ["char_type_id"], name: "index_words_on_char_type_id", using: :btree
t.index ["position"], name: "index_words_on_position", using: :btree
Expand Down
0