Skip to content

Commit

Permalink
Merge pull request #26 from TarteelAI/export-ayah-script
Browse files Browse the repository at this point in the history
Export ayah script
  • Loading branch information
naveed-ahmad authored Aug 2, 2024
2 parents 7687cf9 + 260c657 commit cad14de
Show file tree
Hide file tree
Showing 14 changed files with 364 additions and 100 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '3.3.3'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem "rails", "~> 7.0.3"
gem "rails", "~> 7.0.4.1"
gem "nokogiri", '~> 1.14.3', require: false

# Use postgresql as the database for Active Record
Expand Down
141 changes: 69 additions & 72 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,47 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.1.0)
actioncable (7.0.3)
actionpack (= 7.0.3)
activesupport (= 7.0.3)
actioncable (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.3)
actionpack (= 7.0.3)
activejob (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
actionmailbox (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.3)
actionpack (= 7.0.3)
actionview (= 7.0.3)
activejob (= 7.0.3)
activesupport (= 7.0.3)
actionmailer (7.0.4.3)
actionpack (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activesupport (= 7.0.4.3)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.3)
actionview (= 7.0.3)
activesupport (= 7.0.3)
actionpack (7.0.4.3)
actionview (= 7.0.4.3)
activesupport (= 7.0.4.3)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.3)
actionpack (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
actiontext (7.0.4.3)
actionpack (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.3)
activesupport (= 7.0.3)
actionview (7.0.4.3)
activesupport (= 7.0.4.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
Expand All @@ -60,24 +60,24 @@ GEM
activeadmin (>= 1.x, < 3)
jquery-rails (>= 3.0, < 5)
select2-rails (~> 4.0)
activejob (7.0.3)
activesupport (= 7.0.3)
activejob (7.0.4.3)
activesupport (= 7.0.4.3)
globalid (>= 0.3.6)
activemodel (7.0.3)
activesupport (= 7.0.3)
activerecord (7.0.3)
activemodel (= 7.0.3)
activesupport (= 7.0.3)
activerecord-import (1.4.0)
activemodel (7.0.4.3)
activesupport (= 7.0.4.3)
activerecord (7.0.4.3)
activemodel (= 7.0.4.3)
activesupport (= 7.0.4.3)
activerecord-import (1.7.0)
activerecord (>= 4.2)
activestorage (7.0.3)
actionpack (= 7.0.3)
activejob (= 7.0.3)
activerecord (= 7.0.3)
activesupport (= 7.0.3)
activestorage (7.0.4.3)
actionpack (= 7.0.4.3)
activejob (= 7.0.4.3)
activerecord (= 7.0.4.3)
activesupport (= 7.0.4.3)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.3)
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -134,6 +134,7 @@ GEM
railties (>= 6.0.0)
csv (3.2.8)
dalli (3.2.8)
date (3.3.4)
devise (4.9.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
Expand All @@ -142,7 +143,6 @@ GEM
warden (~> 1.2.3)
diff-lcs (1.5.0)
diffy (3.4.2)
digest (3.1.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (3.1.2)
Expand Down Expand Up @@ -262,9 +262,12 @@ GEM
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lru_redux (1.1.0)
mail (2.7.1)
mail (2.8.1)
mini_mime (>= 0.1.1)
marcel (1.0.2)
net-imap
net-pop
net-smtp
marcel (1.0.4)
mechanize (2.8.5)
addressable (~> 2.8)
domain_name (~> 0.5, >= 0.5.20190701)
Expand All @@ -281,7 +284,7 @@ GEM
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mini_magick (4.11.0)
mini_mime (1.1.2)
mini_mime (1.1.5)
mini_portile2 (2.8.1)
minitest (5.18.0)
msgpack (1.5.2)
Expand All @@ -292,20 +295,14 @@ GEM
net-http-digest_auth (1.4.1)
net-http-persistent (4.0.1)
connection_pool (~> 2.2)
net-imap (0.2.3)
digest
net-imap (0.4.14)
date
net-protocol
strscan
net-pop (0.1.1)
digest
net-protocol
timeout
net-protocol (0.1.3)
net-pop (0.1.2)
net-protocol (0.2.2)
timeout
net-smtp (0.3.1)
digest
net-smtp (0.5.0)
net-protocol
timeout
netrc (0.11.0)
nio4r (2.5.9)
nokogiri (1.14.3)
Expand Down Expand Up @@ -354,28 +351,28 @@ GEM
rack
rack-test (2.0.1)
rack (>= 1.3)
rails (7.0.3)
actioncable (= 7.0.3)
actionmailbox (= 7.0.3)
actionmailer (= 7.0.3)
actionpack (= 7.0.3)
actiontext (= 7.0.3)
actionview (= 7.0.3)
activejob (= 7.0.3)
activemodel (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
rails (7.0.4.3)
actioncable (= 7.0.4.3)
actionmailbox (= 7.0.4.3)
actionmailer (= 7.0.4.3)
actionpack (= 7.0.4.3)
actiontext (= 7.0.4.3)
actionview (= 7.0.4.3)
activejob (= 7.0.4.3)
activemodel (= 7.0.4.3)
activerecord (= 7.0.4.3)
activestorage (= 7.0.4.3)
activesupport (= 7.0.4.3)
bundler (>= 1.15.0)
railties (= 7.0.3)
railties (= 7.0.4.3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.4)
loofah (~> 2.19, >= 2.19.1)
railties (7.0.3)
actionpack (= 7.0.3)
activesupport (= 7.0.3)
railties (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand Down Expand Up @@ -504,7 +501,7 @@ GEM
strscan (3.0.9)
thor (1.2.1)
tilt (2.0.11)
timeout (0.3.0)
timeout (0.4.1)
ttfunk (1.7.0)
turbo-rails (1.1.1)
actionpack (>= 6.0.0)
Expand Down Expand Up @@ -535,7 +532,7 @@ GEM
railties (>= 6.0.0)
webrick (1.7.0)
webrobots (0.1.2)
websocket-driver (0.7.5)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
yard (0.9.28)
Expand Down Expand Up @@ -584,7 +581,7 @@ DEPENDENCIES
pry-rails
puma (>= 5.6.4)
rack-cors
rails (~> 7.0.3)
rails (~> 7.0.4.1)
rails-html-sanitizer (>= 1.4.2)
redcarpet
redis (~> 4.0)
Expand Down
4 changes: 2 additions & 2 deletions app/assets/stylesheets/shared/font_faces.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ $asset-version: "1";

@font-face {
font-family: 'indopak-nastaleeq';
src: url("#{$font-cdn}nastaleeq/indopak-nastaleeq-waqf-lazim.woff2?v=#{$asset-version}");
src: url("#{$font-cdn}/nastaleeq/indopak-nastaleeq-waqf-lazim.woff2?v=#{$asset-version}");
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'qpc-nastaleeq';
src: url("#{$font-cdn}nastaleeq/KFGQPCNastaleeq-Regular.woff2?v=#{$asset-version}");
src: url("#{$font-cdn}/nastaleeq/KFGQPCNastaleeq-Regular.woff2?v=#{$asset-version}");
}

.mushaf-qpc-nastaleeq{
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/resources_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ def download

def show
@resources = DownloadableResource.published.where(resource_type: params[:id])

if @resources.empty?
redirect_to resources_path, alert: 'Sorry, this resource does not exist.'
end
end
end
2 changes: 1 addition & 1 deletion app/helpers/landing_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def featured_downlodable_resource_cards
title: "Mushaf layouts",
description: "Download Mushaf layout data to render Quran pages exactly like the printed Mushaf. The exact layout aids in memorizing the Quran, offering users a familiar experience similar to their favorite printed Mushaf.",
icon: 'layout.svg',
url: '/resources/mushaf-layouts',
url: '/resources/mushaf-layout',
count: total_layout,
type: 'card-mushaf-layouts',
# TODO: once all layout are approved, stats will looks weird. Fix the messaging
Expand Down
8 changes: 6 additions & 2 deletions app/models/downloadable_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ def group_heading
end
end

def sample_text

end

def icon
case resource_type
when 'quran-script'
'fa-book-open'
'fa-font'
when 'recitation'
'fa-headphones-alt'
when 'translation'
Expand Down Expand Up @@ -138,7 +142,7 @@ def group_name

def group_info
case resource_type
when 'script'
when 'quran-script'
'The Holy Quran in its original Arabic script'
when 'recitation'
'Audio files and segments'
Expand Down
8 changes: 8 additions & 0 deletions app/models/resource_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ def one_ayah?
cardinality_type == CardinalityType::OneVerse
end

def quran_script?
sub_type == SubType::QuranText
end

def has_footnote?
meta_value('has-footnote') == 'yes'
end
Expand All @@ -162,6 +166,10 @@ def has_segments?
meta_value('has-segments') == 'yes'
end

def has_mushaf_layout?
meta_value('mushaf').present?
end

def get_source_pdf_url
url = meta_value('source-pdf-url')

Expand Down
15 changes: 15 additions & 0 deletions app/models/word.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,21 @@ def text_for_mushaf(mushaf_id)
end
end

def qa_tajweed_image
s,a,w=location.split(':')
"https://static.qurancdn.com/images/w/qa-color/#{s}/#{a}/#{w}.png"
end

def rq_tajweed_image
s,a,w=location.split(':')
"https://static.qurancdn.com/images/w/rq-color/#{s}/#{a}/#{w}.png"
end

def qa_black_image
s,a,w=location.split(':')
"https://static.qurancdn.com/images/w/qa-black/#{s}/#{a}/#{w}.png"
end

def word?
'word' == char_type_name
end
Expand Down
7 changes: 7 additions & 0 deletions app/views/resources/_quran_script_preview.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<%
text = preview_verse.send(resource.meta_value('text_type'))
%>

<div class="bg-primary p-1 rounded quran-text <%= resource.meta_value('font')%> p574-<%= resource.meta_value('font') %>">
<%= text.html_safe %>
</div>
Loading

0 comments on commit cad14de

Please sign in to comment.