diff --git a/Gemfile b/Gemfile index e209c6bb..2d1f0233 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index db20f83b..3e39db26 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) diff --git a/app/assets/stylesheets/shared/font_faces.scss b/app/assets/stylesheets/shared/font_faces.scss index ba76a891..3327467a 100644 --- a/app/assets/stylesheets/shared/font_faces.scss +++ b/app/assets/stylesheets/shared/font_faces.scss @@ -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{ diff --git a/app/controllers/resources_controller.rb b/app/controllers/resources_controller.rb index cac0dec1..b70aca50 100644 --- a/app/controllers/resources_controller.rb +++ b/app/controllers/resources_controller.rb @@ -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 \ No newline at end of file diff --git a/app/helpers/landing_helper.rb b/app/helpers/landing_helper.rb index e4c2523a..fbfd3fbd 100644 --- a/app/helpers/landing_helper.rb +++ b/app/helpers/landing_helper.rb @@ -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 diff --git a/app/models/downloadable_resource.rb b/app/models/downloadable_resource.rb index 530ffa38..afeb230f 100644 --- a/app/models/downloadable_resource.rb +++ b/app/models/downloadable_resource.rb @@ -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' @@ -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' diff --git a/app/models/resource_content.rb b/app/models/resource_content.rb index 03fa73a2..d6c4c37e 100644 --- a/app/models/resource_content.rb +++ b/app/models/resource_content.rb @@ -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 @@ -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') diff --git a/app/models/word.rb b/app/models/word.rb index 6670dd9a..b4d61e1b 100644 --- a/app/models/word.rb +++ b/app/models/word.rb @@ -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 diff --git a/app/views/resources/_quran_script_preview.html.erb b/app/views/resources/_quran_script_preview.html.erb new file mode 100644 index 00000000..952b7b3d --- /dev/null +++ b/app/views/resources/_quran_script_preview.html.erb @@ -0,0 +1,7 @@ +<% + text = preview_verse.send(resource.meta_value('text_type')) +%> + +
diff --git a/app/views/resources/show.html.erb b/app/views/resources/show.html.erb index e66038f2..0fbad2c6 100644 --- a/app/views/resources/show.html.erb +++ b/app/views/resources/show.html.erb @@ -59,6 +59,13 @@